Commit 9caf5b68 authored by gxkai's avatar gxkai

chore: ts

parent 1ee18b2e
......@@ -16,23 +16,24 @@ module.exports = config => {
}
if (process.env.NODE_ENV === 'production') {
const CompressionPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
webpackConfig.plugins.push(new CompressionPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240, // 只有大小大于该值的资源会被处理 10240
minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
deleteOriginalAssets: true // 删除原文件true=删
}))
// const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
// webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: true // 删除原文件true=删
// }))
return {
...webpackConfig,
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
...webpackConfig
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
}
} else {
return webpackConfig
......
......@@ -16,23 +16,24 @@ module.exports = config => {
}
if (process.env.NODE_ENV === 'production') {
const CompressionPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf','eot','woff','woff2','webp','png','sol']
webpackConfig.plugins.push(new CompressionPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240, // 只有大小大于该值的资源会被处理 10240
minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
deleteOriginalAssets: true // 删除原文件true=删
}),)
// const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf','eot','woff','woff2','webp','png','sol']
// webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: true // 删除原文件true=删
// }),)
return {
...webpackConfig,
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
}
} else {
return webpackConfig
......
......@@ -16,23 +16,24 @@ module.exports = config => {
}
if (process.env.NODE_ENV === 'production') {
const CompressionPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
webpackConfig.plugins.push(new CompressionPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240, // 只有大小大于该值的资源会被处理 10240
minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
deleteOriginalAssets: true // 删除原文件true=删
}))
// const CompressionPlugin = require('compression-webpack-plugin')
// const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
// webpackConfig.plugins.push(new CompressionPlugin({
// filename: '[path].gz[query]',
// algorithm: 'gzip',
// test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
// threshold: 10240, // 只有大小大于该值的资源会被处理 10240
// minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
// deleteOriginalAssets: true // 删除原文件true=删
// }))
return {
...webpackConfig,
mode: 'production',
optimization: {
minimize: true,
minimizer: [new TerserPlugin()]
}
...webpackConfig
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin()]
// }
}
} else {
return webpackConfig
......
......@@ -28,7 +28,7 @@
"nx": "nx",
"start": "nx start",
"serve": "nx serve",
"build": "nx build",
"build": "npm run build:dev",
"test": "nx test",
"lint": "nx lint",
"affected:apps": "nx affected:apps",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment