Skip to content

Commit

Permalink
add webpack arg for extending config
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhollow committed Jan 29, 2024
1 parent 3c68358 commit 831ac7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -252,7 +253,7 @@ function ncc (
}));
}

const compiler = webpack({
const compiler = webpack(extendWebpack({
entry,
cache: cache === false ? undefined : {
type: "filesystem",
Expand Down Expand Up @@ -383,7 +384,7 @@ function ncc (
},
},
plugins
});
}));
compiler.outputFileSystem = mfs;
if (!watch) {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 831ac7f

Please sign in to comment.