12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- // const dev_baseURL = 'http://git.waywish.com:9100';
- const dev_baseURL = 'https://www.waywish.com';
- const isProduction = process.env.NODE_ENV === 'production'; //是否为生产环境
- const path = require("path");
- const Happypack = require('happypack');
- function resolve(dir) {
- return path.join(__dirname, dir);
- }
- module.exports = {
- publicPath: './',
- outputDir: '../src/main/resources/static/console',
- 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');
- 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]",
- })
- // 生产环境配置
- if (isProduction) {
- // 压缩代码
- config.optimization.minimize(true);
- // 分割代码
- config.optimization.splitChunks({
- chunks: 'all'
- })
- }
- },
- configureWebpack: {
- devtool: process.env.NODE_ENV === 'development' ? 'eval' : false,
- plugins: [
- new Happypack({
- loaders: ['babel-loader', 'vue-loader'],
- cache: true,
- threads: 10 // 线程数取决于你电脑性能的好坏,好的电脑建议开更多线程
- })
- ]
- },
- 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/scss/common.scss";
- `
- }
- },
- }
- }
|