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

Hoisted or aliased variable issue with webpack #529

Closed
JSteunou opened this issue May 10, 2017 · 4 comments · Fixed by #533
Closed

Hoisted or aliased variable issue with webpack #529

JSteunou opened this issue May 10, 2017 · 4 comments · Fixed by #533
Labels
has PR Has an open PR that fixes this issue

Comments

@JSteunou
Copy link

JSteunou commented May 10, 2017

My build with webpack and babili produced that kind of code

var _Mathround = Math.round;
webpackJsonp([11], {
    1022: function(a, b, c) {
        'use strict';
        var d = c(0)
          , e = c(7).sprintf
          , f = c(3)
          , g = c(1023);
        a.exports = {
            getFoo: function(k, l) {
                return _Mathround(k.score);
            },
            ...
        };
    },
    ...
});

with this error TypeError: _Mathround is not a function

Chrome devtool sees _Mathround as a Global variable when I try to debug, but it is undefined

@boopathi
Copy link
Member

var _Mathround = Math.round and _Mathround is undefined during debugging ?. Not sure what the issue is.

But, this has changed recently in #472 - where it doesn't add to global, but to some parent scope which is not global. Not sure that would resolve this issue.

Are you able to reproduce it in the REPL ?

@vigneshshanmugam
Copy link
Member

We didn't release the fix yet and REPL has 0.10.0 which doesn't have this feature

@JSteunou Can you try this with latest babili master if possible?

@JSteunou
Copy link
Author

I tried to test with latest babili master but

  1. npm install babel/babili do not work, I guess because this is a lurna repo
  2. I manually replace babel-plugin-minify-builtins/lib/index.js with master with no luck: ERROR in unknown: parent.get(...).unshiftContainer is not a function I guess it depends on other things

for now setting builtIns to false set the trick

@vigneshshanmugam
Copy link
Member

Alright, we will probably release a minor version with some fixes soon, Hopefully that will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR Has an open PR that fixes this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants