Skip to content

Commit

Permalink
feat(ncc): Add -external options.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Feb 23, 2022
1 parent ccf5d59 commit dbf6b60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ncc/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
@kkt/ncc
===

[![npm version](https://img.shields.io/npm/v/@kkt/ncc.svg)](https://www.npmjs.com/package/@kkt/ncc)

Simple CLI for compiling a Node.js module into a single file, together with all its dependencies, gcc-style. A tool created based on [`kkt`](https://github.com/kktjs/kkt) & [`create-react-app`](https://github.com/facebook/create-react-app), [`@kkt/ncc`](https://www.npmjs.com/package/@kkt/ncc) similar to [@vercel/ncc](https://www.npmjs.com/package/@vercel/ncc)

## Usage
Expand Down Expand Up @@ -77,7 +79,6 @@ As always, thanks to our amazing contributors!

Made with [github-action-contributors](https://github.com/jaywcjlove/github-action-contributors).


### License

Licensed under the MIT License
2 changes: 2 additions & 0 deletions packages/ncc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface NCCArgs extends BuildArgs {
out?: string;
target?: string;
minify?: boolean;
external?: string[];
sourceMap?: boolean;
}

Expand Down Expand Up @@ -180,6 +181,7 @@ process.on('exit', (code) => {
conf.target = target;
conf.mode = env === 'development' ? 'development' : 'production';
conf.output = {};
if (argvs.external) conf.externals = argvs.external;
if (conf.output) {
conf.output.libraryTarget = 'commonjs';
conf.output.path = outDir;
Expand Down

0 comments on commit dbf6b60

Please sign in to comment.