我有一个相当简单的 Rails 应用程序,它有一些刺激控制器。在升级到 rails 5.8 和 webpacker 5 时,我得到这个错误:
Uncaught Error: Module parse failed: Unexpected token (3:17)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| import { Controller } from "stimulus";
| export default class extends Controller {
> static targets = ["contribution", "totalbudget", "submit"];
我尝试按照here的建议删除我的.babelrc,然后尝试将代码从.babelrc复制到babel.config.js。这些都没有帮助。
如何配置 webpacker / babel 和应用程序再次运行?