Rails webpacker + vue给出了未捕获的错误:模块构建失败来自./node_modules/babel-loader/lib/index.js:

问题描述

当我在rails上安装webpacker + vue时,出现了此错误,我安装了它想要的一些依赖项,即package.json:

{
  "dependencies": {
    "@rails/webpacker": "4.3.0","babel-plugin-syntax-dynamic-import": "^6.18.0","babel-plugin-transform-class-properties": "^6.24.1","babel-plugin-transform-object-rest-spread": "^6.26.0","babel-preset-env": "^1.7.0","babel-preset-react": "^6.24.1","vue": "^2.6.12","vue-loader": "^15.9.3","vue-template-compiler": "^2.6.12"
  },"devDependencies": {
    "webpack-dev-server": "^3.11.0"
  }
}

我正在布局中使用此标签:

    <%= javascript_pack_tag 'hello_vue' %>
    <%= stylesheet_pack_tag 'hello_vue' %>

这是hello_vue.js:

import Vue from 'vue'
import App from '../app.vue'

document.addEventListener('DOMContentLoaded',() => {
  const app = new Vue({
    render: h => h(App)
  }).$mount()
  document.body.appendChild(app.$el)
})

我的日志中出现此错误:

bootstrap:83 Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects,only functions. In /mnt/c/Users/smond/dev/mandala/node_modules/babel-preset-react/lib/index.js

我还没有创建任何webpack.config.js,我是否必须创建一个webpack.config.js文件,我不明白我应该在useMemo文件中添加什么

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...