mjackson / esbuild-node-builtins-sideeffects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo shows how esbuild leaves the import for unused node builtins in the output bundle.

To reproduce:

$ npm install
$ npm run build

Then inspect output.js.

Now switch the import in input.js to import from ./local-fs instead of fs. Run the build again and you should not see the import in the output because there is a sideEffects: false in package.json.

It'd be nice if esbuild used an implicit sideEffects: false for node builtins since they are purely library code and don't have any side effects.

About


Languages

Language:JavaScript 100.0%