andrewdavey / immutable-devtools

Chrome Dev Tools custom formatter for Immutable-js values
BSD 3-Clause "New" or "Revised" License
661 stars 29 forks source link

'install' is undefined, function name appears to have been removed by uglification #12

Closed jedwards1211 closed 8 years ago

jedwards1211 commented 8 years ago

EDIT I'm bundling with Webpack. I think the problem is the script is getting run in strict mode.

I just installed and tried to use this. When I load my page I get an 'install' is undefined error.

Looking at the code in node_modules/immutable-devtools/dist/index.js, it looks like src/index.js is transformed from this:

// Check for globally defined Immutable and add an install method to it.
if (typeof Immutable !== "undefined") {
  Immutable.installDevTools = install.bind(null, Immutable);
}

// I imagine most people are using Immutable as a CommonJS module though...

let installed = false;
module.exports = function install(Immutable) {
...

To this:

Immutable.installDevTools=install.bind(null,Immutable));var o=!1;n.exports=function(n){if("undefined"==typeof window)

As you can see, uglification removed the name of the install function.

Looking forward to using this though, thanks!

andrewdavey commented 8 years ago

Does moving the install function up to the top fix it?

jedwards1211 commented 8 years ago

yup! basically what I did in a fork to go ahead and get it running

langpavel commented 8 years ago

function name should not affect actual export. Also this should be resolved by #15