Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building a tree shaking package using rollup. #9

Open
chen86860 opened this issue Dec 3, 2021 · 0 comments
Open

Building a tree shaking package using rollup. #9

chen86860 opened this issue Dec 3, 2021 · 0 comments
Labels

Comments

@chen86860
Copy link
Owner

chen86860 commented Dec 3, 2021

rollup-esm-template

Building a tree shaking package using rollup.

Requirements

  1. Set a slideEffect: false flag in package.json
    "sideEffects": false,
  1. Make all export to input
  2. Setting output to esm
export default {
  input: ["src/*.ts"],
  output: {
    dir: pkg.module,
    format: "esm",
  },
  plugins: [commonjs(), typescript(), resolve(), multiInput()],
};
  1. Build it!

Usage

import { foo } from "@chen86860/rollup-esm-template";

foo();

For that, the bar function in @chen86860/rollup-esm-template will not build into bundle by tree shaking.


Related repository: rollup-esm-template

@chen86860 chen86860 added the blog label Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant