123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- const {
- defineConfig
- } = require('@vue/cli-service');
- const dev_baseURL = 'https://www.waywish.com';
- const isProduction = process.env.NODE_ENV === 'production'; //是否为生产环境
- const path = require("path");
- const resolve = (dir) => {
- return path.join(__dirname, dir);
- }
- module.exports = defineConfig({
- publicPath: './',
- outputDir: '../src/main/resources/static/workark',
- assetsDir: 'static',
- lintOnSave: false,
- productionSourceMap: false,
- // webpack配置
- // see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
- chainWebpack: config => {
- // 移除 prefetch 插件
- config.plugins.delete('prefetch')
- // 移除 preload 插件
- config.plugins.delete('preload');
- // 生产环境配置
- if (isProduction) {
- // 压缩代码
- config.optimization.minimize(true);
- // 分割代码
- config.optimization.splitChunks({
- chunks: 'all'
- })
- }
- },
- configureWebpack: {
- devtool: process.env.NODE_ENV === 'development' ? 'eval' : false,
- plugins: []
- },
- devServer: {
- port: 8080, // 端口
- open: false, // 自动开启浏览器
- compress: false, // 开启压缩
- hot: true, // 模块热替换
- client: {
- overlay: { // 当出现编译错误或警告时,在浏览器中显示全屏覆盖。
- warnings: true,
- errors: true
- },
- progress: true, // 在浏览器中以百分比形式打印编译进度。
- },
- proxy: {
- '/v1': {
- target: dev_baseURL,
- changeOrigin: true,
- ws: true,
- pathRewrite: {
- '^/v1': ''
- }
- }
- }
- },
- // css相关配置
- css: {
- // css预设器配置项
- loaderOptions: {
- // pass options to sass-loader
- sass: {
- // 引入全局变量样式
- prependData: `
- @import "@/assets/css/element-variables.scss";
- `
- }
- },
- }
- })
|