I've run into an issue with Zurb Foundation 6, which ships un-transpiled ES2015 code in its library. A similar issue to the one I'm experiencing is this one.
The solution suggested on that issue, and I've seen similar elsewhere, is to modify the exclude rule on the Babel plugin to not exclude node-modules/foundation-sites. The problem I'm having is that I can't see how to do that in webpacker, even after reading the configuration docs
Essentially, what I need to add is the following rule:
exclude: /node_modules\/(?!(foundation-sites)\/).*/,
to the Babel loader. So far, I've failed miserably. Any help would be much appreciated!
You can add option like so:
// config/webpack/environment.js
const { environment } = require('@rails/webpacker')
const babelLoader = environment.loaders.get('babel')
babelLoader.exclude = /node_modules\/(?!(foundation-sites)\/).*/
module.exports = environment
@gauravtiwari Thank you so much for helping! I'm pretty sure I would not have got there on my own :)
@gauravtiwari you are a lifesaver 馃憤
Most helpful comment
You can add option like so: