我正在尝试Vue,首先使用Webpack,它工作顺利,所以现在我尝试将它与Brunch集成,因为它是凤凰使用的但是我得到了这个神秘的错误:
找不到模块' babel-runtime / core-js / json / stringify'
我尝试从我原来的Webpack项目package.json
复制所有与babel相关的依赖项,但我仍然得到相同的错误,我不知道为什么。
我尝试使用纱线,尝试删除node_modules
,然后重新安装,尝试不同版本的babel-runtime无济于事。
我当前的package.json看起来像这样:
"dependencies": {
"node-sass": "^4.5.2",
"phoenix": "file:deps/phoenix",
"phoenix_html": "file:deps/phoenix_html",
"pug": "^2.0.0-rc.1",
"sass-brunch": "^2.10.4",
"vue": "^2.3.3",
"vue-brunch": "^2.0.1",
"vue-resource": "^1.3.1",
"vue-router": "^2.5.3"
},
"devDependencies": {
"css-loader": "^0.28.1",
"webpack": "^2.5.1",
"babel-brunch": "~6.0.0",
"brunch": "2.7.4",
"clean-css-brunch": "~2.0.0",
"css-brunch": "~2.0.0",
"javascript-brunch": "~2.0.0",
"uglify-js-brunch": "~2.0.1",
"babel-core": "^6.22.1",
"babel-loader": "^6.2.10",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"vue-loader": "^11.3.4",
"vue-style-loader": "^2.0.5",
"vue-template-compiler": "^2.2.6"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"babel": {
"plugins": ["transform-runtime"]
}
答案 0 :(得分:1)
从我收集的内容来看,这与早午餐如何加载模块有关。您的输入文件需要' bootstrap'它将使用的所有其他模块。
尝试将此行添加到您的条目文件
import 'babel-runtime/core-js/json/stringify';
您可能还需要在主文件中要求您的应用中需要的其他模块,您不需要在主文件中使用它们,但是为了要求它们在组件或其他文件不是您需要执行此操作的主要文件' bootstrapping。'