Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Outputs the Node.js compact build of `input.js` into `dist/index.js`.
--v8-cache Emit a build using the v8 compile cache
--license [file] Adds a file containing licensing information to the output
--stats-out [file] Emit webpack stats as json to the specified output file
--target [es] ECMAScript target to use for output (default: es2015)
--target [es] ECMAScript or Node.js target to use for output (default: es2015)
Learn more: https://webpack.js.org/configuration/target
-d, --debug Show debug logs
```
Expand Down
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Options:
--v8-cache Emit a build using the v8 compile cache
--license [file] Adds a file containing licensing information to the output
--stats-out [file] Emit webpack stats as json to the specified output file
--target [es] ECMAScript target to use for output (default: es2015)
--target [es] ECMAScript or Node.js target to use for output (default: es2015)
Learn more: https://webpack.js.org/configuration/target
-d, --debug Show debug logs
`;
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function ncc (
console.log(`ncc: Compiling file ${filename} into ${esm ? 'ESM' : 'CJS'}`);
}

if (target && !target.startsWith('es')) {
throw new Error(`Invalid "target" value provided ${target}, value must be es version e.g. es2015`)
if (target && (!target.startsWith('es') || !target.startsWith('node'))) {
throw new Error(`Invalid "target" value provided ${target}, value must be "esX" or "node[[X].Y]" e.g. es2015 or node20`)
}

const resolvedEntry = resolve.sync(entry);
Expand Down