我正在使用Laravel 5.8 我正在使用VueJs制作SPA,
存在某些依赖性的问题
这是打开某些页面时的错误
我的package.json
依赖项是
"dependencies": {
"@riophae/vue-treeselect": "^0.2.0",
"axios": "^0.18",
"buefy": "^0.7.8",
"bulma": "^0.7.5",
"vee-validate": "^2.2.11",
"vue": "^2.5.17",
"vue-awesome-swiper": "^3.1.3",
"vue-router": "^3.1.3"
}
我的package.json
devDependency是
devDependencies:
"browser-sync": "^2.26.7",
"cross-env": "^5.2.0",
"laravel-mix": "^4.0.7",
"sass": "^1.22.7",
"sass-loader": "7.*",
"vue-template-compiler": "^2.6.10"
我猜这些vue-treeselect
和vue-awesome-swiper
出现了一些问题,一段时间后可以正常工作,但有时会显示错误
我的webpack.mix.js
const mix = require('laravel-mix');
mix.browserSync({
proxy: 'localhost:8000'
})
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
mix.webpackConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, 'resources'),
},
},
output: {
publicPath: '/',
chunkFilename: 'js/[name].[chunkhash].js',
},
});
这是我导入vue-swiper的方式
import { swiper, swiperSlide } from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
导入vue-treeselect
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
答案 0 :(得分:0)
尝试更换:
'@': path.resolve(__dirname, 'resources'),
使用:
'~': path.resolve(__dirname, 'resources/js'),
并更新:
import Treeselect from '@riophae/vue-treeselect'
使用:
import { Treeselect } from '@riophae/vue-treeselect'