Skip to content

Commit 40376d0

Browse files
committed
add webpack arg for extending config
1 parent 3c68358 commit 40376d0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ require('@vercel/ncc')('/path/to/input', {
127127
target: 'es2015', // default
128128
v8cache: false, // default
129129
quiet: false, // default
130-
debugLog: false // default
130+
debugLog: false, // default
131+
webpack: (config) => config // default
131132
}).then(({ code, map, assets }) => {
132133
console.log(code);
133134
// Assets is an object of asset file names to { source, permissions, symlinks }

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function ncc (
5757
production = true,
5858
// webpack defaults to `module` and `main`, but that's
5959
// not really what node.js supports, so we reset it
60-
mainFields = ['main']
60+
mainFields = ['main'],
61+
webpack: extendWebpack = (config) => config
6162
} = {}
6263
) {
6364
// v8 cache not supported for ES modules
@@ -252,7 +253,7 @@ function ncc (
252253
}));
253254
}
254255

255-
const compiler = webpack({
256+
const compiler = webpack(extendWebpack({
256257
entry,
257258
cache: cache === false ? undefined : {
258259
type: "filesystem",
@@ -383,7 +384,7 @@ function ncc (
383384
},
384385
},
385386
plugins
386-
});
387+
}));
387388
compiler.outputFileSystem = mfs;
388389
if (!watch) {
389390
return new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)