Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The memory usage during project runtime after upgrade is very high #5158

Closed
ChenBin12138 opened this issue Apr 20, 2024 · 2 comments
Closed

Comments

@ChenBin12138
Copy link

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')
}
}
},
}
})

`

@ChenBin12138
Copy link
Author

Snipaste_2024-04-20_16-17-37

@alexander-akait
Copy link
Member

Please use https://github.com/webpack/webpack/discussions for such questions, because we don't know the real reason, also please provide minimum reproducible test repo or profiling, otherwise we can't help sorry, also please run npm ls webpack and show me this in https://github.com/webpack/webpack/discussions, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants