Fails to export a module if the argument is the function name
See original GitHub issueI’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.
(function(J){function X(Z){if($[Z])return$[Z].exports;var oe=$[Z]={ // many KB of JS ->
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.
<script>$ = window.$</script>
But the second project that I’ve started mangles it into H
:
(function(o){function U(W){if(H[W])return H[W].exports;var Y=H[W]={ // many KB of JS ->
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
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Fixed in #414
If you’re dependencies are flat, (npm >= 3 | yarn ), then you can install
babili-webpack-plugin
andnpm link babel-preset-babili
in your codebase. So babili-webpack-plugin can use this master version ofbabel-preset-babili
.