You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function resolve(dir) {
return path.join(__dirname, dir)
}
const webpackConfig = {
// 打包环境
production: {
optimization: {
runtimeChunk: "single",
splitChunks: {
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\/]node_modules[\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\/]node_modules[\/]?element-ui(.*)/ // in order to adapt to cnpm
},
vxEasyui: {
name: 'chunk-vx-easyui', // split vx-easyui into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\/]node_modules[\/]?vx-easyui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
}
},
},
// 开发环境
development: {
watchOptions: {
ignored: [
// 忽略监听的目录或文件
'/node_modules/',
'/dist/',
],
},
devtool: "eval-cheap-module-source-map",
output: {
pathinfo: false,
},
optimization: {
runtimeChunk: true,
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
}
}[process.env.NODE_ENV]
Bug report
upgradation :
vue@2.6.10 => vue@2.7.16
webpack@4.47.0 => webpack@5.91.0
webpack-dev-server@3.11.3 => webpack-dev-server@4.15.2
The memory usage during project runtime after upgrade is very high, Modifying code compilation also lags behind.
Actual Behavior
Expected Behavior
How Do We Reproduce?
Please paste the results of
npx webpack-cli info
here, and mention other relevant information`
const { defineConfig } = require('@vue/cli-service')
const path = require('path');
const fs = require('fs');
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
function resolve(dir) {
return path.join(__dirname, dir)
}
const webpackConfig = {
// 打包环境
production: {
optimization: {
runtimeChunk: "single",
splitChunks: {
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\/]node_modules[\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-elementUI', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\/]node_modules[\/]?element-ui(.*)/ // in order to adapt to cnpm
},
vxEasyui: {
name: 'chunk-vx-easyui', // split vx-easyui into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\/]node_modules[\/]?vx-easyui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
}
},
},
// 开发环境
development: {
watchOptions: {
ignored: [
// 忽略监听的目录或文件
'/node_modules/',
'/dist/',
],
},
devtool: "eval-cheap-module-source-map",
output: {
pathinfo: false,
},
optimization: {
runtimeChunk: true,
removeAvailableModules: false,
removeEmptyChunks: false,
splitChunks: false,
},
}
}[process.env.NODE_ENV]
module.exports = defineConfig({
transpileDependencies: true,
runtimeCompiler: true,
publicPath: '/',
outputDir: 'dist',
productionSourceMap: false,
configureWebpack: {
plugins: [
new NodePolyfillPlugin()
],
cache: {
type: 'filesystem',
buildDependencies: {
config: [__filename],
package: [path.resolve(__dirname, 'package-lock.json')]
},
},
externals: {
'echarts': 'echarts',
'./cptable': 'var cptable',
fs
},
module: {
rules: [
{
test: /.js$/,
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true
}
},
exclude: /node_modules/,
include: [resolve('src')]
},
]
},
resolve: {
alias: {
'@': resolve('src')
},
fallback: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
crypto: false
},
},
...webpackConfig
},
devServer: {
port: 81,
hot: true,
client: {
overlay: false,
},
proxy: {
'/_gataway': {
target: "",
changeOrigin: true,
pathRewrite: {
'^/_gataway': '/'
},
router: () => {
return fs.readFileSync(process.cwd() + '/proxyUrl.env', 'utf8')
}
}
},
}
})
`
The text was updated successfully, but these errors were encountered: