TheSpyder / named-imports-rollup

Demonstrating named imports and tree shaking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Named imports and tree shaking

Demonstrating that import * as name from ... style named imports are tree shaken by Rollup.

Info

index.mjs is the entry point, which imports arr.mjs. It can be executed by nodejs to demonstrate that it works. With rollup, only the range method of arr.mjs is included in the output.

Usage

  • yarn
  • yarn run to show the code works
  • yarn build && cat scratch/index.js to see ronge is tree shaken out

uncomment the last line of index.mjs and rebuild to see ronge is imported.

Credits

Arr.range implementation borrowed from katamari which is Apache licensed

License

Do whatever you want 🤷‍♂️

About

Demonstrating named imports and tree shaking


Languages

Language:JavaScript 100.0%