vue实际开发项目中,默认的打包可能不符合我们的设计,这时候就需要我们进行自定义了
1.找到/vue.config.js文件,修改module.exports配置
const {
defineConfig
} = require('@vue/cli-service')
module.exports = defineConfig({
//在项目配置的时候,默认 npm 包导出的是运行时构建,即 runtime 版本,不支持编译 template 模板
runtimeCompiler: true,
//关闭eslint校验
lintOnSave: false,
//webpack配置
configureWebpack: {
//关闭 webpack 的性能提示
performance: {
hints: false
},
},
transpileDependencies: true,
// index.html的路径
indexPath: '../index.html',
//默认输出文件夹为dist,我们也可以去修改他
outputDir: '../public/myDist3',
//将css,js和img静态资源文件夹放在同一个文件夹中
assetsDir: 'assets',
//打包后静态资源加前缀,index.html中引用资源的前缀
publicPath: '/myDist3',
//在实际开发过程中,前后端分离必定会存在跨域,设置代理