Browse Source

Use fs.realpathSync() rather than path.resolve() to match filenames passed to require.extensions[]. On Windows resolve(...) returns "c:\..." but realpath(...) returns "C:\...".

semi-dynamic-namespace-imports
Kurt Blackwell 9 years ago
parent
commit
ce1c784f5b
  1. 7
      bin/src/runRollup.js

7
bin/src/runRollup.js

@ -1,4 +1,4 @@
import { resolve } from 'path';
import { realpathSync } from 'fs';
import relative from 'require-relative';
import handleError from './handleError';
import SOURCEMAPPING_URL from './sourceMappingUrl.js';
@ -54,7 +54,8 @@ export default function runRollup ( command ) {
}
}
} else {
config = resolve( config );
// find real path of config so it matches what Node provides to callbacks in require.extensions
config = realpathSync( config );
}
rollup.rollup({
@ -79,7 +80,7 @@ export default function runRollup ( command ) {
};
try {
const options = require( resolve( config ) );
const options = require( config );
if ( Object.keys( options ).length === 0 ) {
handleError({ code: 'MISSING_CONFIG' });
}

Loading…
Cancel
Save