Wk-notes-01-16-Bundling-Treeshaking-1
Bundle a cjs build, a es build, a esm build,
and using rollup to build a umd build
and in package.json, the main entry is point to cjs dir, module entry is point to esm dir
What’s the difference between
esandesm? seems difference is in the@babael/preset-enves is for browser script tags, esm is for basically not transpiling. the main difference is the level of transpiling you need to do a lot more to support the shittier versions of browsers that first supported <script type="module>
What’s babel-env ‘production’ and ‘production-umd’ ?
nothing really
Where is the output of
npm run build:umd?Checkout the actual code for the command, say
rollup.config.js, which just use some process to output a umd bundle (umd single file). And babel don't support umd bundling.Why are we bundling in different module systems ?
To support different ways of import/require. Preact have this https://unpkg.com/browse/[email protected]/dist/ different. lodash also enables different build
Why do we symlink
lib/node_moduleinbuild:prepare-bundle?because CI needs to deploy with
semantic-releaseand its too slow tocpa directoryWhich part of this new way of bundling enable treeshaking ?
esm, and specific path based imports
How do we consume this bundle from
widget? What changes when we consume it w/ different module solution?how i've done it in my PR's so far but instead its now going to be like
import Button from '@qantasairways/runway/components/Button';
Last updated
Was this helpful?