indutny / webpack-common-shake

CommonJS Tree Shaker plugin for WebPack
918 stars 13 forks source link

False bailout for `require`. #17

Open jdalton opened 7 years ago

jdalton commented 7 years ago

I'm seeing

WARNING in global bailout from webpack-common-shake
Invalid use of `require` at [/path/to//esm/src/module/make-require-function.js:35:9]

Which looks like this. It's being babel transpiled back to cjs and scope hoisted with webpack. The plugin is bailing out because it's seeing the use of require without checking that it's a local reference and not the environment variable.