71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
const { defineConfig } = require('@vue/cli-service');
|
||
|
||
module.exports = defineConfig({
|
||
// 部署应用包时的基本 URL
|
||
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
||
|
||
// 当运行 vue-cli-service build 时生成的生产环境构建文件的目录
|
||
outputDir: 'dist',
|
||
|
||
// 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
|
||
assetsDir: 'static',
|
||
|
||
// 指定生成的 index.html 的输出路径 (相对于 outputDir)
|
||
indexPath: 'index.html',
|
||
|
||
// 默认情况下,生成的静态资源在它们的文件名中包含了 hash 以便更好的控制缓存
|
||
filenameHashing: true,
|
||
|
||
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码
|
||
lintOnSave: process.env.NODE_ENV !== 'production',
|
||
|
||
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建
|
||
productionSourceMap: false,
|
||
|
||
// 开发服务器配置
|
||
devServer: {
|
||
host: '0.0.0.0',
|
||
port: 8080,
|
||
open: true,
|
||
// proxy: {
|
||
// // 配置跨域
|
||
// '/': {
|
||
// target: 'http://192.168.137.45:8080',
|
||
// changeOrigin: true,
|
||
// pathRewrite: {
|
||
// '^/api': ''
|
||
// }
|
||
// }
|
||
// }
|
||
},
|
||
|
||
// CSS相关配置
|
||
css: {
|
||
// 是否使用css分离插件 ExtractTextPlugin
|
||
extract: process.env.NODE_ENV === 'production',
|
||
// 开启 CSS source maps?
|
||
sourceMap: false,
|
||
// css预设器配置项
|
||
loaderOptions: {
|
||
sass: {
|
||
// 全局引入变量和 mixin
|
||
additionalData: `
|
||
@import "@/assets/styles/variables.scss";
|
||
`
|
||
}
|
||
}
|
||
},
|
||
|
||
// webpack配置
|
||
configureWebpack: {
|
||
// 配置 webpack 压缩
|
||
optimization: {
|
||
minimize: process.env.NODE_ENV === 'production'
|
||
}
|
||
},
|
||
|
||
// 第三方插件配置
|
||
pluginOptions: {
|
||
// ...
|
||
}
|
||
});
|