如何解决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 举报,一经查实,本站将立刻删除。