You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As indicated in the ESBuild documentation, ESbuild is able to tree shake a JSON import when we use named imports.
Unfortunately, named imports for JSON files are now an outdated feature in JS engines.
A JSON file must now be imported as a default import and with an import attribute.
ESbuild could recognize standard JSON imports and tree shake them.
Instead of relying on esbuild to set the package version of the CLI,
we now load it from `VERSION.json`.
`scipts/version.sh` and thus `npm version` update `VERSION.json`.
We could directly load `package.json`,
unfortunately ESbuild is not able to tree-shake JSON files.
I opened the following issue: evanw/esbuild#4000
We have to require NodeJS 20.10.0 or above for import attributes.
Instead of relying on esbuild to set the package version of the CLI,
we now load it from `VERSION.json`.
`scipts/version.sh` and thus `npm version` update `VERSION.json`.
We could directly load `package.json`,
unfortunately ESbuild is not able to tree-shake JSON files.
I opened the following issue: evanw/esbuild#4000
We have to require NodeJS 20.10.0 or above for import attributes.
As indicated in the ESBuild documentation, ESbuild is able to tree shake a JSON import when we use named imports.
Unfortunately, named imports for JSON files are now an outdated feature in JS engines.
A JSON file must now be imported as a default import and with an import attribute.
ESbuild could recognize standard JSON imports and tree shake them.
Given the following code:
And assuming that
version
is set to1.0.0
inpackage.json
, ESbuild could output the following bundled code:The text was updated successfully, but these errors were encountered: