/* * @Author: shuishen 1109946754@qq.com * @Date: 2022-09-07 09:37:07 * @LastEditors: shuishen 1109946754@qq.com * @LastEditTime: 2023-05-04 20:46:04 * @FilePath: \web\bigScreen\vue.config.js * @Description: * * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved. */ const path = require("path") const CopywebpackPlugin = require("copy-webpack-plugin") const dvgisDist = "./node_modules/@dvgis" const webpack = require("webpack") const CompressionPlugin = require("compression-webpack-plugin") const pxtovw = require("postcss-px-to-viewport") const productionGzipExtensions = ["js", "css"] module.exports = { //路径前缀 publicPath: "/bigScreen/", css: { loaderOptions: { // 给 sass-loader 传递选项 scss: { prependData: `@import "~@/styles/scssFile.scss";`, }, }, }, outputDir: 'bigScreen', // 其他配置 chainWebpack: (config) => { config.plugin("copy").use(CopywebpackPlugin, [ [ { from: path.join(dvgisDist, "dc-sdk/dist/resources"), to: "libs/dc-sdk/resources", }, { from: "./public/libs", to: "libs", }, { from: "./public/depend", to: "depend", }, { from: "./public/images", to: "images", }, { from: "./public/check", to: "check", }, { from: "./public/mapIcons", to: "mapIcons", } ], ]) }, configureWebpack: { externals: { vue: "Vue", Vuex: "Vuex", "vue-router": "VueRouter", "element-ui": "ELEMENT", echarts: "echarts", }, // webpack plugins plugins: [ // Ignore all locale files of moment.js new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // 配置compression-webpack-plugin压缩 new CompressionPlugin({ algorithm: "gzip", test: new RegExp("\\.(" + productionGzipExtensions.join("|") + ")$"), threshold: 10240, minRatio: 0.8, }), new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 5, minChunkSize: 100, }), ], }, devServer: { proxy: { // 业务平台接口 "/api": { // target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址 target: "http://124.164.10.118:2081", // target: "http://192.168.0.102:81", // ws: true, //启用webSocket6566 changeOrigin: true, //开启代理跨域 pathRewrite: {}//后端接口包含/api前缀,不需要重写 }, }, }, }