Skip to content

Instantly share code, notes, and snippets.

@janwirth
Created March 12, 2019 09:07
Show Gist options
  • Save janwirth/7080dd284d4aa87741ccbb78a22005f6 to your computer and use it in GitHub Desktop.
Save janwirth/7080dd284d4aa87741ccbb78a22005f6 to your computer and use it in GitHub Desktop.
Edit babel configuration in create-elm-app
module.exports = {
configureWebpack: (config, env) => {
const rules = config.module.rules
rules
.map(r => {
// find js rule
if (r.test && r.test.toString().indexOf('js') > -1) {
// find the rule with the actual babel config
if (r.use) {
r.use[0].options.plugins = r.use[0].options.plugins || []
r.use[0].options.plugins.push('@babel/plugin-syntax-dynamic-import')
}
}
})
return config
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment