-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
Fails to export a module if the argument is the function name #439
Comments
Babili does NOT treat If there is And babili already detects usages of global variables, say |
OK just spent a while comparing the minified and unminified bundle trying to find the problem. The problem wasn't at the start of the file. Babili is converting this function in the function hex(hex) {
if (hex.length === 4) {
hex = '#' + hex.charAt(1) + hex.charAt(1) +
hex.charAt(2) + hex.charAt(2) +
hex.charAt(3) + hex.charAt(3);
}
return [
parseInt(hex.substring(1,3), 16),
parseInt(hex.substring(3,5), 16),
parseInt(hex.substring(5,7), 16)
];
}
module.exports = hex; to: function(o){o.exports=H} So I think it is a bug with the minifier not recognising that the function If I rename the argument in that module, it exports all of the logic properly. function(o){o.exports=function(W){return 4===W.length&&(W='#'+W.charAt(1)+W.charAt(1)+W.charAt(2)+W.charAt(2)+W.charAt(3)+W.charAt(3)),[parseInt(W.substring(1,3),16),parseInt(W.substring(3,5),16),parseInt(W.substring(5,7),16)]}} |
Fixed in #414 |
Do you plan on releasing this on npm soon? Or, alternatively, how do I install the master branch of |
If you're dependencies are flat, (npm >= 3 | yarn ), then you can install |
I'm using babili on two separate React projects through the babili-webpack-plugin. Apologies for the crap issue title, I'm not sure what sort of hellish issue this is.
The first couple of characters into the minified JS bundle fails because it can't access
window.$
, as in the shorthand for the query selector.First thoughts: I'm not telling babili to generate browser-ready code but I can't find any documentation on that.
So I was able to hack a solution by adding this before the bundle
<script>
because it doesn't mangle the fact that it is$
. And everything 100% works once it has that line.But the second project that I've started mangles it into
H
:So now I'm even more lost. The first repo is open source so the production webpack process, package.json and .babelrc are all here: https://github.com/danbovey/Dekt
The text was updated successfully, but these errors were encountered: