使用laravel项目集成vue2-admin-lte包,不过在写demo的时候出现了一些状况。
-
别名 `mix.webpackConfig({ resolve: {
alias:{ 'va': 'vue2-admin-lte/src' }
} });` 在webpack.mix.js添加如上代码使用的时候别名并没有起作用,只能使用全名路径vue2-admin-lte/src。
-
编译出错 npm run dev时报错:Module build failed: ReferenceError: Unknown plugin "transform-runtime" specified in "E:\pub\ubody_pubhealth\node_modules\[email protected]@vue2-admin-lte\.babelrc" at 0, attempted to resolve relative to "E:\pub\ubody_pubhealth\node_modules\_vue2-a [email protected]@vue2-admin-lte"
通过网上查找原因,执行命令npm install babel-plugin-transform-runtime 解决。 不过又出现:Module build failed: Error: Couldn't find preset "stage-2" relative to directory "E:\pub\ubody_pubhealth\node_modules\[email protected]@vue2-admin-lte" 通过网络查找原因,执行npm install --save-dev babel-preset-stage-2解决问题,编译成功。 这里涉及到.babelrc文件,这个文件只是大概了解一下,并没有具体掌握