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
When using externalHelpers: true, all helpers are imported from the helpers.js file.
This is not optimal because the helpers.js file is not a module and therefore will prevent tree shaking when bundling.
Instead we should provide a package.json that handles the export of the helpers. There we can set sideEffects: false and also use the .mjs file if possible.
I tried that out by adding the following package.json in node_modules/babel-plugin-transform-async-to-promises/helpers/package.json
Notice that I prefixed the helpers files with a- to ensure that the bundler picks the package.json instead of the plain file when importing like import { _await } from "babel-plugin-transform-async-to-promises/helpers";.
This worked for me and decreased the overall bundle size.
The text was updated successfully, but these errors were encountered:
pubkey
changed the title
Not tree shaking with externalHelpers: true
No tree shaking with externalHelpers: true
Dec 30, 2021
pubkey
added a commit
to pubkey/rxdb
that referenced
this issue
Dec 30, 2021
When using
externalHelpers: true
, all helpers are imported from thehelpers.js
file.This is not optimal because the helpers.js file is not a module and therefore will prevent tree shaking when bundling.
Instead we should provide a package.json that handles the export of the helpers. There we can set
sideEffects: false
and also use the.mjs
file if possible.I tried that out by adding the following package.json in
node_modules/babel-plugin-transform-async-to-promises/helpers/package.json
Notice that I prefixed the helpers files with
a-
to ensure that the bundler picks the package.json instead of the plain file when importing likeimport { _await } from "babel-plugin-transform-async-to-promises/helpers";
.This worked for me and decreased the overall bundle size.
The text was updated successfully, but these errors were encountered: