systemjs / builder

SystemJS build tool
MIT License
465 stars 122 forks source link

systemJs builder buildStatic doesn't seem to do rollup #840

Open dozer75 opened 6 years ago

dozer75 commented 6 years ago

According to other issues (e.g. #709) it seems that buildStatic should do rollup if the modules is es2015/es6, but I can't get this to work with systemjs builder 0.16.12. I have done everything that it seems that should be done, but it just doesn't treeshake my solution. If i try to run rollup without systemjs builder it works.

Attach to this issue is a simple example project that I have problems with.

To reproduce it do the following:

  1. unzip the attachment
  2. run npm install
  3. run tsc
  4. run node_modules/.bin/gulp default

Open the bundle.js and see that ChildModule2 is included in the script even if it isn't referenced anywhere. If I use rollup directly the resulting bundle doesn't include ChildModule2.

I have tried to modify the buildStatic options to specifically haverollup: true with the same result, also tried other settings that differs with #709 without any difference.

It may be something I miss, but the documentation is at best lacking for this feature.

Attachment: TreeShaker.zip