[英]Setup babel plugin with Rails 5 webpacker
I'm trying to setup the idx
babel plugin from Facebook in a Rails app that uses Webpacker. 我正在尝试在使用Webpacker的Rails应用程序中从Facebook设置
idx
babel插件。
https://github.com/facebookincubator/idx https://github.com/facebookincubator/idx
https://github.com/rails/webpacker https://github.com/rails/webpacker
How can I do this properly? 如何正确执行此操作?
Okay I figured this out. 好吧,我知道了。 Must add it to the babel.js loader.
必须将其添加到babel.js加载程序。
// config/webpack/loaders/babel.js
module.exports = {
test: /\.js(\.erb)?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
plugins: [
require('babel-plugin-idx'),
],
presets: [
['env', { modules: false }]
]
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.