question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails to export a module if the argument is the function name

See original GitHub issue

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.

(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:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
boopathicommented, Feb 28, 2017

Fixed in #414

0reactions
boopathicommented, Mar 1, 2017

If you’re dependencies are flat, (npm >= 3 | yarn ), then you can install babili-webpack-plugin and npm link babel-preset-babili in your codebase. So babili-webpack-plugin can use this master version of babel-preset-babili.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Export-ModuleMember does not export functions when ...
Export -ModuleMember "Test-Function2", "Test-Function3". I have to remove -Function parameter name. then it works on both windows powershell ...
Read more >
NodeJs. Problem with module.export; it is not a function error
I have written this piece of code:
Read more >
PowerShell Module Function Export in Constrained Language
When PowerShell is running in Constrained Language mode it adds some restrictions in how module functions can be exported.
Read more >
export - JavaScript - MDN Web Docs
This re-exports all named exports from mod as the named exports of the current module, but the default export of mod is not...
Read more >
Node Module Exports Explained - freeCodeCamp
exports being the exported component of any types - object, function, string, and so on. Default exporting in a Node.js module is as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found