12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- const path = require('path')
- const fs = require('fs')
- //const TerserPlugin = require('terser-webpack-plugin')
- /**
- * 拼接相对于当前目录的下 文件的相对路径
- * @param dir 目录
- * @return {string}
- */
- function resolove(dir) {
- return path.join(__dirname, dir)
- }
- module.exports = {
- lintOnSave: true,
- productionSourceMap: false,
- css: {
- },
- devServer: {
- proxy: {
- '/api': {
- // 本地服务接口地址
- target: 'http://127.0.0.1:8443/',
- ws: true,
- pathRewrite: {
- '^/api': '/',
- },
- },
- },
- },
- chainWebpack: config => {
- // 移除 prefetch 插件
- config.plugins.delete('prefetch');
- config.resolve.alias
- .set('IMG', resolove('static/image'))
- .set('PAGES', resolove('pages'))
- .set('COMPONENTS', resolove('components'))
- .set('UTIL', resolove('utils'))
- .set('API', resolove('api'));
- },
- configureWebpack: {
- plugins: [],
- optimization: {
- minimizer: [
- /** new TerserPlugin({
- terserOptions: {
- warnings: false,
- compress: {
- drop_console: true,
- drop_debugger: true,
- pure_funcs: ['console.log']
- }
- }
- })*/
- ]
- }
- }
- };
|