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.

Corrupted bundle when including babel-polyfill

See original GitHub issue

Hello!

I’ve spot a very tricky situation when including the babel-polyfill and building with bankai. There’s a repository here to reproduce the error.

During the build phase, bankai is applying tinyify transformation that minifies code, but also removes the function wrappers around each module. When babel-polyfill is added, it creates several variable conflicts between modules, and the generated bundle becomes unusable.

This doesn’t happen when:

  • using bankai start command
  • using bundle-collapser plugin instead of browser-pack-flat plugin, which requires to set flat option to false. As bankai doesn’t allow to set this option, it must be changed manually in node_modules

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
goto-bus-stopcommented, Jan 2, 2018

ohh i see, browser-pack-flat is not renaming the Math variable defined in one of core-js’s modules. a quick fix would be to add knowledge of global browser variables to browser-pack-flat. a better one would be to keep track of all undefined variables used by each module and assume all of them are globals. i’ll check out if the latter is doable and otherwise add the former for now

thanks for the repro!

0reactions
goto-bus-stopcommented, Jan 3, 2018

assuming this is resolved then 😃 thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Corrupted Javascript bundle in Production but running fine ...
I've a React app with node server and I had perfectly fine production bundle a few days ago but recently my production bundle...
Read more >
babel/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >
Babel polyfill documentation for Webpack is wrong ...
When '@babel/polyfill' is included in webpack entry point as per documentation and "useBuiltIns": "entry" is used then then @babel/polyfill is ...
Read more >
4 Reasons Why Your Source Maps are Broken
Source maps are awesome... when they work. Here are four reasons why your source maps are broken and tips on how to fix...
Read more >
Error Boundaries
In the past, JavaScript errors inside components used to corrupt React's ... consider including a Function.name polyfill in your bundled application, ...
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