mobxjs / mobx-react-devtools

[DEPRECATED] Tools to perform runtime analyses of React applications powered by MobX and React
MIT License
1.23k stars 49 forks source link

Add support for Webpack 4 tree shaking / dead code elimination #83

Closed jraoult closed 6 years ago

jraoult commented 6 years ago

I'm using a Webpack 4.

The combination of tree shaking and dead code elimination would make this snippet generate a bundle where mobx-react-devtools is not included in production mode.

import DevTools from 'mobx-react-devtools';
console.log("noop");

It is not the case right now since mobx-react-devtools is not declared side effects free.

I managed to work around it using a module rule:

{
  module: {
    rules: [
      {
        test: /node_modules\/mobx-react-devtools/,
        sideEffects: false
      }
    ]
  }
}

Ideally mobx-react-devtools would declare that it is side effects free (cf https://stackoverflow.com/a/49203452), if it is the case of course (which I think it is)

mweststrate commented 6 years ago

Released as mobx-react-devtools@6.0.1