diff --git a/readme.md b/readme.md index 5068ac36..19baf0e4 100644 --- a/readme.md +++ b/readme.md @@ -127,7 +127,8 @@ require('@vercel/ncc')('/path/to/input', { target: 'es2015', // default v8cache: false, // default quiet: false, // default - debugLog: false // default + debugLog: false, // default + webpack: (config) => config // default }).then(({ code, map, assets }) => { console.log(code); // Assets is an object of asset file names to { source, permissions, symlinks } diff --git a/src/index.js b/src/index.js index 8ffa3022..2abae4c2 100644 --- a/src/index.js +++ b/src/index.js @@ -57,7 +57,8 @@ function ncc ( production = true, // webpack defaults to `module` and `main`, but that's // not really what node.js supports, so we reset it - mainFields = ['main'] + mainFields = ['main'], + webpack: extendWebpack = (config) => config, } = {} ) { // v8 cache not supported for ES modules @@ -252,7 +253,7 @@ function ncc ( })); } - const compiler = webpack({ + const compiler = webpack(extendWebpack({ entry, cache: cache === false ? undefined : { type: "filesystem", @@ -383,7 +384,7 @@ function ncc ( }, }, plugins - }); + })); compiler.outputFileSystem = mfs; if (!watch) { return new Promise((resolve, reject) => {