jsii icon indicating copy to clipboard operation
jsii copied to clipboard

Incorrectly Packaging node_modules In Distribution

Open GEMISIS opened this issue 3 years ago • 3 comments

Describe the bug

When packaging my distribution, JSII is bundling the node_modules directory as well for the javascript distribution. This drastically balloons up the size, and there is no way to prevent it from doing so.

Expected Behavior

Don't bundle the node_modules directory with js distributions.

Current Behavior

It's bundling the node_modules directory with js distributions.

Reproduction Steps

Just do a normal build with whatever dependencies you ahve.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.72.0

Environment details (OS name and version, etc.)

Mac OS X (Intel)

GEMISIS avatar Jan 09 '23 06:01 GEMISIS

Hi @GEMISIS We will need some more information on this. JSII doesn't really package anything itself. jsii-pacmak is using npm pack under the hood. If node_modules are included in the created package, than something in the configuration is likely wrong. What is your .npmignore and files in package.json look like? What version of npm are you using?

mrgrain avatar Feb 19 '24 10:02 mrgrain

The project in question where this is occuring can be found at https://github.com/GEMISIS/discord-bot-cdk-construct

It sounds like maybe npm pack has a bug? Or are you saying I should add node_modules to my .npmignore?

GEMISIS avatar Feb 19 '24 23:02 GEMISIS

You have a number of bundled dependencies: https://github.com/GEMISIS/discord-bot-cdk-construct/blob/main/package.json#L98-L106

It is expected that node_modules will be included in the produced artifact. Are you seeing any that you think should not be bundled?

mrgrain avatar Feb 20 '24 09:02 mrgrain

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar May 15 '24 14:05 github-actions[bot]