|
|
@@ -45,11 +45,11 @@ module.exports = { |
|
|
|
filename: `js/js[name].${timeStamp}.js`, |
|
|
|
chunkFilename: `js/chunk.[id].${timeStamp}.js`, |
|
|
|
}, |
|
|
|
resolve: { |
|
|
|
alias: { |
|
|
|
'@': path.resolve(__dirname, 'src') |
|
|
|
} |
|
|
|
}, |
|
|
|
resolve: { |
|
|
|
alias: { |
|
|
|
'@': path.resolve(__dirname, 'src') |
|
|
|
} |
|
|
|
}, |
|
|
|
externals, |
|
|
|
}, |
|
|
|
css: { |
|
|
@@ -57,70 +57,70 @@ module.exports = { |
|
|
|
filename: `css/[name].${timeStamp}.css`, |
|
|
|
chunkFilename: `css/chunk.[id].${timeStamp}.css`, |
|
|
|
}, |
|
|
|
loaderOptions: { |
|
|
|
css: { |
|
|
|
}, |
|
|
|
// postcss: { |
|
|
|
// // options here will be passed to postcss-loader |
|
|
|
// plugins: [require('postcss-px2rem')({ |
|
|
|
// remUnit: 75 |
|
|
|
// })] |
|
|
|
// } |
|
|
|
} |
|
|
|
}, |
|
|
|
loaderOptions: { |
|
|
|
css: { |
|
|
|
}, |
|
|
|
// postcss: { |
|
|
|
// // options here will be passed to postcss-loader |
|
|
|
// plugins: [require('postcss-px2rem')({ |
|
|
|
// remUnit: 75 |
|
|
|
// })] |
|
|
|
// } |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
pwa: { |
|
|
|
iconPaths: { |
|
|
|
favicon32: 'favicon.ico', |
|
|
|
favicon16: 'favicon.ico', |
|
|
|
appleTouchIcon: 'favicon.ico', |
|
|
|
maskIcon: 'favicon.ico', |
|
|
|
msTileImage: 'favicon.ico' |
|
|
|
} |
|
|
|
pwa: { |
|
|
|
iconPaths: { |
|
|
|
favicon32: 'favicon.ico', |
|
|
|
favicon16: 'favicon.ico', |
|
|
|
appleTouchIcon: 'favicon.ico', |
|
|
|
maskIcon: 'favicon.ico', |
|
|
|
msTileImage: 'favicon.ico' |
|
|
|
} |
|
|
|
}, |
|
|
|
//http://www.metavatar.cc/ |
|
|
|
devServer: { |
|
|
|
overlay: { |
|
|
|
warnings: false, |
|
|
|
errors: false |
|
|
|
}, |
|
|
|
//http://www.metavatar.cc/ |
|
|
|
devServer: { |
|
|
|
overlay: { |
|
|
|
warnings: false, |
|
|
|
errors: false |
|
|
|
proxy: { |
|
|
|
'/api': { |
|
|
|
// target: 'https://smapitestmalls,iformall.com/C/api', |
|
|
|
target: process.env.VUE_APP_API_ROOT + '/api', |
|
|
|
changeOrigin: true, |
|
|
|
pathRewrite: { |
|
|
|
'^/api': '' |
|
|
|
}, |
|
|
|
proxy: { |
|
|
|
'/api': { |
|
|
|
// target: 'https://smapitestmalls,iformall.com/C/api', |
|
|
|
target: process.env.VUE_APP_API_ROOT+'/api', |
|
|
|
changeOrigin: true, |
|
|
|
pathRewrite: { |
|
|
|
'^/api': '' |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
lintOnSave: false, |
|
|
|
publicPath: './', // 打包后引用的资源路径 |
|
|
|
} |
|
|
|
}, |
|
|
|
lintOnSave: false, |
|
|
|
publicPath: './', // 打包后引用的资源路径 |
|
|
|
|
|
|
|
chainWebpack: config => { |
|
|
|
// favicon图标 |
|
|
|
config.plugin('html').tap(args => { |
|
|
|
args[0].favicon = './public/favicon.ico'; |
|
|
|
return args; |
|
|
|
}); |
|
|
|
// 注入cdn变量 (打包时会执行) |
|
|
|
config.plugin('html').tap(args => { |
|
|
|
args[0].cdn = cdn // 配置cdn给插件 |
|
|
|
return args |
|
|
|
}) |
|
|
|
// 图片路径 |
|
|
|
config.module.rule('images') |
|
|
|
// favicon图标 |
|
|
|
config.plugin('html').tap(args => { |
|
|
|
args[0].favicon = './public/favicon.ico'; |
|
|
|
return args; |
|
|
|
}); |
|
|
|
// 注入cdn变量 (打包时会执行) |
|
|
|
config.plugin('html').tap(args => { |
|
|
|
args[0].cdn = cdn // 配置cdn给插件 |
|
|
|
return args |
|
|
|
}) |
|
|
|
// 图片路径 |
|
|
|
config.module.rule('images') |
|
|
|
.use('url-loader') |
|
|
|
.tap(options => ({ |
|
|
|
name: './assets/images/[name].[ext]', |
|
|
|
quality: 85, |
|
|
|
limit: 0, |
|
|
|
esModule: false, |
|
|
|
name: './assets/images/[name].[ext]', |
|
|
|
quality: 85, |
|
|
|
limit: 0, |
|
|
|
esModule: false, |
|
|
|
})) |
|
|
|
//图片压缩 |
|
|
|
config.module |
|
|
|
//图片压缩 |
|
|
|
config.module |
|
|
|
.rule('images') |
|
|
|
.use('image-webpack-loader') |
|
|
|
.loader('image-webpack-loader') |
|
|
@@ -144,9 +144,9 @@ module.exports = { |
|
|
|
} |
|
|
|
}) |
|
|
|
.end(); |
|
|
|
|
|
|
|
|
|
|
|
// 压缩js,只能线上,本地会js访问错误,会将js压缩成.gz文件 |
|
|
|
if (process.env.VUE_APP_ENV != 'development') { |
|
|
|
if (process.env.VUE_APP_ENV != 'development') { |
|
|
|
config.plugin('compression-webpack-plugin').use(new CompressionWebpackPlugin({ |
|
|
|
test: /\.(js|css|scss|woff|woff2|ttf)$/, // 匹配文件名 |
|
|
|
threshold: 20480, // 对超过20k的数据压缩 |
|
|
@@ -164,19 +164,19 @@ module.exports = { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
// configureWebpack: { |
|
|
|
// plugins: [ |
|
|
|
// //打包环境去掉console.log |
|
|
|
// new UglifyJsPlugin({ |
|
|
|
// uglifyOptions: { |
|
|
|
// compress: { |
|
|
|
// drop_console: true, //注释console |
|
|
|
// drop_debugger: true, //注释debugger |
|
|
|
// pure_funcs: ['console.log'], //移除console.log |
|
|
|
// }, |
|
|
|
// }, |
|
|
|
// }), |
|
|
|
// ], |
|
|
|
// } |
|
|
|
} |
|
|
|
// configureWebpack: { |
|
|
|
// plugins: [ |
|
|
|
// //打包环境去掉console.log |
|
|
|
// new UglifyJsPlugin({ |
|
|
|
// uglifyOptions: { |
|
|
|
// compress: { |
|
|
|
// drop_console: true, //注释console |
|
|
|
// drop_debugger: true, //注释debugger |
|
|
|
// pure_funcs: ['console.log'], //移除console.log |
|
|
|
// }, |
|
|
|
// }, |
|
|
|
// }), |
|
|
|
// ], |
|
|
|
// } |
|
|
|
} |