| | |
| | | const CompressionPlugin = require('compression-webpack-plugin') |
| | | |
| | | module.exports = { |
| | | publicPath: '/', |
| | | lintOnSave: false, |
| | | // 其他配置 |
| | | chainWebpack: (config) => { |
| | | config.plugin('copy').use(CopywebpackPlugin, [ |
| | | [ |
| | | { |
| | | from: path.join(dvgisDist, 'dc-sdk/dist/resources'), |
| | | to: 'libs/dc-sdk/resources' |
| | | }, |
| | | { |
| | | from: './public/img', |
| | | to: 'img' |
| | | }, |
| | | { |
| | | from: './public/examples', |
| | | to: 'examples' |
| | | }, |
| | | { |
| | | from: './public/mx', |
| | | to: 'mx' |
| | | }, |
| | | { |
| | | from: './public/wp', |
| | | to: 'wp' |
| | | }, |
| | | { |
| | | from: './public/favicon.ico', |
| | | to: 'favicon.ico' |
| | | } |
| | | ] |
| | | ]) |
| | | }, |
| | | // 减少chunk-vendors.js文件大小 |
| | | // 报错 TypeError: Cannot read property 'tapPromise' of undefined |
| | | // 解决 ,把compression-webpack-plugin包退回成 compression-webpack-plugin@5.0.1 即可 |
| | | // 文件由8M 减成2.5M |
| | | productionSourceMap: false, // 代码压缩加密 |
| | | configureWebpack: { |
| | | // webpack plugins |
| | | plugins: [ |
| | | // 提供带 Content-Encoding 编码的压缩版的资源 |
| | | new CompressionPlugin({ |
| | | algorithm: 'gzip', |
| | | test: /\.js$|\.html$|\.css/, // 匹配文件名 |
| | | // test: /\.(js|css)$/, |
| | | threshold: 10240, // 对超过10k的数据压缩 |
| | | deleteOriginalAssets: false, // 不删除源文件 |
| | | minRatio: 0.8 // 压缩比 |
| | | }) |
| | | ] |
| | | } |
| | | publicPath: '/', |
| | | lintOnSave: false, |
| | | // 其他配置 |
| | | chainWebpack: (config) => { |
| | | config.plugin('copy').use(CopywebpackPlugin, [ |
| | | [ |
| | | { |
| | | from: path.join(dvgisDist, 'dc-sdk/dist/resources'), |
| | | to: 'libs/dc-sdk/resources' |
| | | }, |
| | | { |
| | | from: './public/img', |
| | | to: 'img' |
| | | }, |
| | | { |
| | | from: './public/examples', |
| | | to: 'examples' |
| | | }, |
| | | { |
| | | from: './public/mx', |
| | | to: 'mx' |
| | | }, |
| | | { |
| | | from: './public/fz', |
| | | to: 'fz' |
| | | }, |
| | | { |
| | | from: './public/wp', |
| | | to: 'wp' |
| | | }, |
| | | { |
| | | from: './public/favicon.ico', |
| | | to: 'favicon.ico' |
| | | } |
| | | ] |
| | | ]) |
| | | }, |
| | | // 减少chunk-vendors.js文件大小 |
| | | // 报错 TypeError: Cannot read property 'tapPromise' of undefined |
| | | // 解决 ,把compression-webpack-plugin包退回成 compression-webpack-plugin@5.0.1 即可 |
| | | // 文件由8M 减成2.5M |
| | | productionSourceMap: false, // 代码压缩加密 |
| | | configureWebpack: { |
| | | // webpack plugins |
| | | plugins: [ |
| | | // 提供带 Content-Encoding 编码的压缩版的资源 |
| | | new CompressionPlugin({ |
| | | algorithm: 'gzip', |
| | | test: /\.js$|\.html$|\.css/, // 匹配文件名 |
| | | // test: /\.(js|css)$/, |
| | | threshold: 10240, // 对超过10k的数据压缩 |
| | | deleteOriginalAssets: false, // 不删除源文件 |
| | | minRatio: 0.8 // 压缩比 |
| | | }) |
| | | ] |
| | | } |
| | | } |