// vue.config.js const path = require("path"); const webpack = require("webpack"); function resolve(dir) { return path.join(__dirname, dir); } module.exports = { // publicPath:'/mcweb/', lintOnSave: false,//关闭eslint // 解决antD 'Inline JavaScript is not enabled' 问题 // css: { // loaderOptions: { // less: { // lessOptions:{ // javascriptEnabled: true // } // } // } // }, // 关闭生产环境sourceMap,加快构建速度 productionSourceMap: false, // 默认在生成的静态资源文件名中包含hash以控制缓存 filenameHashing: true, css: { loaderOptions: { // variable.scss 文件放在src/assets/style/variable.scss ,里面是一些要用到的全局变量, sass: { prependData: `@import "@/assets/style/variable.scss" ;`, sassOptions: { outputStyle: 'expanded'//处理sass 打包环境图标乱码问题 } } } }, devServer: { inline: true, open: true, // 启动打开浏览器 hot: true, // 热更新 // historyApiFallback: true, compress: true, overlay: { warnings: false, errors: true, }, proxy: { // "/mediate": { // target: "http://mediate.dev.trydotec.com/", // 管理中心 // changeOrigin: true, // pathRewrite: { // "^/mediate": "/", // }, // }, "/mediate": { target: "http://mediate.dev.trydotec.com", // 调解 changeOrigin: true, pathRewrite: { "^/mediate": "/", }, }, //测试 // "/mediate": { // target: "http://221.236.31.183:8620/mediate", // 管理中心 // changeOrigin: true, // pathRewrite: { // "^/mediate": "/", // }, // }, // "/mediate": { // target: "http://221.236.31.183:8620/mediate", // 调解 // changeOrigin: true, // pathRewrite: { // "^/mediate": "/", // }, // }, '/ws': { //webSocket代理 target: 'ws://0.0.0.0:8881/ws', // 内网 ws: true,//开启ws, 如果是http代理此处可以不用设置 changeOrigin: true, pathRewrite: { '^/ws': '/' } } }, }, configureWebpack: { name: "notary-web", resolve: { alias: { "@": resolve("src"), }, }, plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ], }, chainWebpack: config => { config.module.rule('vue').use('vue-loader').loader('vue-loader').tap(options => { options.compilerOptions.preserveWhitespace = true return options }) .end(); // svg 配置 // set svg-sprite-loader 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]' }) .end() // https://webpack.js.org/configuration/devtool/#development config.when(process.env.NODE_ENV === "development", (config) => config.devtool("source-map") ); } }