From ce1c784f5b6a3d476518fd4ee0a9c62c2499366a Mon Sep 17 00:00:00 2001 From: Kurt Blackwell Date: Thu, 30 Jun 2016 20:38:20 +0800 Subject: [PATCH] Use fs.realpathSync() rather than path.resolve() to match filenames passed to require.extensions[]. On Windows resolve(...) returns "c:\..." but realpath(...) returns "C:\...". --- bin/src/runRollup.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/src/runRollup.js b/bin/src/runRollup.js index 923fb1e..5613dbb 100644 --- a/bin/src/runRollup.js +++ b/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' }); }