我用Laravel
和Vuejs
编写了程序,在localhost
上运行良好,但在host
上却出错。
问题:
程序在本地主机上运行良好,但是当我将其放在主机上时,出现以下错误:
[vue-router]无法解决异步组件默认设置: ChunkLoadError:加载块供应商〜演示失败
ChunkLoadError: "Loading chunk vendors~demo failed.
(missing: http://example.com/vendors~demo.js)"
requireEnsure http://example.com/js/manifest.js:127
component webpack-internal:///./resources/js/router.js:56
resolveAsyncComponents webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1904
flatMapComponents webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1931
flatMapComponents webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1931
flatMapComponents webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1930
resolveAsyncComponents webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1866
iterator webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:2121
step webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1847
step webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1851
step webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1851
step webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:1848
iterator webpack-internal:///./node_modules/vue-router/dist/vue-router.esm.js:2140
_callee$ webpack-internal:///./resources/js/permission.js:109
我做什么:
Webpack
,但这并不能解决问题。问题出在哪里?
答案 0 :(得分:2)
我使用以下命令来获取已编译的js
文件,这是一个错误。 这些对于开发目的很有帮助。
npm run watch
或
yarn watch
使用以下命令获取输出,这样您就不会遇到像我这样的问题。
npm run prod