module.exports = { publicPath: '/sdpart', //部署路径后缀 assetsDir: 'static', // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录。 indexPath: 'index.html', // 指定生成的 index.html 的输出路径 (相对于 outputDir)。也可以是一个绝对路径。 filenameHashing: true, // 文件名hash,默认 lintOnSave: false, // 开发环境下通过 eslint-loader 在每次保存时 lint 代码 productionSourceMap: false, // 关闭生产环境的 source map // chainWebpack: (config) => { // config.module // .rule('sfw') // .test(/\.swf$/) // .use('url-loader') // .loader('url-loader') // .options({ // limit: 10000 // }) // }, chainWebpack(config) { config.module .rule('swf') .test(/\.swf$/) .use('url-loader') .loader('url-loader') .options({ limit: 1024, name: 'file/[path][name].[hash:7].[ext]' }) .end() }, configureWebpack: config => { if (process.env.NODE_ENV === 'production') { // 为生产环境修改配置... config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true; config.mode = 'production'; config["performance"] = { //打包文件大小配置 "maxEntrypointSize": 10000000, "maxAssetSize": 30000000 } } else { // 为开发环境修改配置... } Object.assign(config, { externals: { 'AMap': 'AMap', 'AMapUI': 'AMapUI' } }) }, devServer: { overlay: { // 让浏览器 overlay 同时显示警告和错误 warnings: true, errors: true }, host: '0.0.0.0', // host: '172.16.120.200', port: 8080, // 端口号 // https: false, // https:{type:Boolean} open: true, // 配置自动启动浏览器 hotOnly: true, // 热更新 proxy: { // 配置多个跨域 '/': { //target: 'http://10.108.34.2:80/sdpart', //向日葵 //target: 'http://101.133.214.75:81/sdpart/', //线上测试 target: 'http://172.16.120.104:8089/', //本地 changeOrigin: true, pathRewrite: { '': '/' } }, }, headers: { 'Access-Control-Allow-Origin': '*', } }, };