ncc icon indicating copy to clipboard operation
ncc copied to clipboard

Feature request: "include" flag (i.e. opposite of "exclude")

Open ctrlplusb opened this issue 4 years ago • 4 comments

It would be great to have a flag to indicate which modules you do wish to include in bundling.

ncc build index.ts -i foo -i bar

Would produce a bundle where the source , foo package, and bar package are bundled. Every other package dependency is referenced from node_modules.

ctrlplusb avatar Jul 15 '21 08:07 ctrlplusb

It sounds like this could be achieved today by looping through dependencies in package.json an adding to --external, correct? Your request here is just a built-in feature to do that?

styfle avatar Jul 16 '21 20:07 styfle

Hi there, any news on this?

fedeci avatar Mar 08 '22 22:03 fedeci

Hello! I'm also interested in this.

It sounds like this could be achieved today by looping through dependencies in package.json an adding to --external, correct? Your request here is just a built-in feature to do that?

@styfle No, I think this misunderstands the request. Doesn't the --external option list modules to not include in the bundle? The OP wishes to explicitly include a module. My use case for this is needed a module included in the bundle that is not explicitly used by the bundled code itself.

heylookltsme avatar Mar 22 '23 15:03 heylookltsme

@heylookltsme In that case, you could add require('something') to your entrypoint file and ncc will include it.

styfle avatar Mar 22 '23 21:03 styfle