123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- const dev_baseURL = 'http://git.workark.com:9100';
- // const dev_baseURL = 'https://www.workark.com';
- const isProduction = process.env.NODE_ENV === 'production'; //是否为生产环境
- const path = require("path");
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- module.exports = {
- publicPath: './',
- outputDir: '../src/main/resources/static/hjconsole',
- 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'
- })
- }
- config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
- config.module
- .rule("icons")
- .test(/\.svg$/)
- .include.add(resolve("src/assets/icons"))
- .end()
- .use("svg-sprite-loader")
- .loader("svg-sprite-loader")
- .options({
- symbolId: "icon-[name]",
- })
- },
- configureWebpack: (config) => {
- // if (isProduction) {
- // config.optimization.minimizer[0].options.minimizer.options.compress = Object.assign(
- // config.optimization.minimizer[0].options.minimizer.options.compress, {
- // drop_console: true
- // }
- // );
- // }
- },
- devServer: {
- port: 8080, // 端口
- open: false, // 自动开启浏览器
- compress: false, // 开启压缩
- 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/common.scss";
- `
- }
- },
- }
- }
|