You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

109 lines
2.8 KiB

/*
* Copyright (c) 2019.
* author: wally
* email: 18603454788@163.com
*/
const path = require("path");
const settings = require("./src/config/setting");
const resolve = (dir) => path.join(__dirname, dir);
const CompressionWebpackPlugin = require("compression-webpack-plugin");
module.exports = {
css: {
loaderOptions: {
less: {
modifyVars: {
"primary-color": "#002582",
},
javascriptEnabled: true,
},
},
},
outputDir: process.env.NODE_ENV === "production" ? "clientapi" : "clienttest",
lintOnSave: true,
publicPath:
process.env.NODE_ENV === "development"
? "/cga/v2/client/"
: settings.publicPath,
transpileDependencies: ["vuetify"],
devServer: {
open: true,
overlay: {
warnings: false,
errors: true,
},
proxy: {
[settings.proxyUrl]: {
// target: "https://www.ylinno.com/cga/v2/api/client/",
target: "http://113.45.159.249:59001/cga/v2/api/client/",
// target: "http://127.0.0.1:19331",
// target: "http://192.168.1.136:19331",
changeOrigin: true,
pathRewrite: {
["^" + settings.proxyUrl]: "",
},
},
},
// proxy: settings.apiUrl,
disableHostCheck: true,
https: false,
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: settings.title,
// devtool: 'source-map',
// description: settings.description,
resolve: {
alias: {
"@": resolve("src"),
api: resolve("src/api"),
components: resolve("src/components"),
views: resolve("src/views"),
config: resolve("src/config"),
},
},
},
chainWebpack: (config) => {
config.when(process.env.NODE_ENV === "development", (config) => {
config.devtool("source-map");
});
config.when(
process.env.NODE_ENV === "production" ||
process.env.NODE_ENV === "productionhs",
(config) => {
config.performance.set("hints", false);
config.devtool("none");
config.plugin("compression").use(CompressionWebpackPlugin, [
{
filename: "[path][base].gz[query]",
algorithm: "gzip",
test: /\.(js|css)$/,
threshold: 8192,
minRatio: 0.8,
deleteOriginalAssets: false,
},
]);
},
);
},
// chainWebpack(config) {
// // set svg-sprite-loader
// config.module
// .rule('svg')
// .exclude.add(resolve('src/icons'))
// .end();
// config.module
// .rule('icons')
// .test(/\.svg$/)
// .include.add(resolve('src/icons'))
// .end()
// .use('svg-sprite-loader')
// .loader('svg-sprite-loader')
// .options({ symbolId: 'icon-[name]' })
// .end();
// },
};