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
Process out of memory - Webpack #1914
Comments
I'm having this too with webpack-dev-server on Debian; but I haven't had time to debug this further. |
Don't use hashes when watching. i. e. |
@sokra In the documentation for css-loader it says to use hash for easier debugging wrt css modules. Does that have the same problem?
We've also started to see this problem in dev (out of memory), but our only hash in dev mode is the css one. EDIT: Of course it uses hash by default, so I'm guessing it's not a problem. |
No. Only filenames. You can compare it with If this is not the issue, you can increase the node.js memory (it defaults to 1.7 GB, which can be too few for big builds). |
I'll test at work on Monday! If the outputted file is of the same name as the old one, then it's overwritten, right? |
jup. You can navigate to http://localhost:8080/webpack-dev-server to see a list of all files in memory. |
Ah, didn't know that! Using a small project I have on my own computer, I notice that all of the hot-update files gets added. Could they be a problem? Any way of clearing them out after they've been there for x amount of time? If we develop for a few hours there's probably quite a few of them in the end |
They could, but they are usually pretty small. |
I think clearing them out like @SimenB said would be a nice option, or maybe there is some way to delete all in-memory files that are no longer in use? |
jup. Write a plugin... |
But deleting them too early can break stuff... |
We have the exact same memory leak problem after using webpack -w on MacOS X. Can you please suggest what is a the best way to fix / workaround this issue. The ngOfficeUIFabric seems to deal with a different problem. Thanks, |
Have same issue of @deepakmani in OSX El Capitan, however i'm using Ionic 2 which in it's config doesn't use const path = require('path')
const PrefetchPlugin = require('webpack/lib/PrefetchPlugin')
const ProvidePlugin = require('webpack/lib/ProvidePlugin')
const DedupePlugin = require('webpack/lib/optimize/DedupePlugin')
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
const WebpackNotifierPlugin = require('webpack-notifier')
module.exports = {
entry: {
polyfills: './app/polyfills.ts',
vendor: './app/vendor.ts',
app: path.resolve('app/app')
},
output: {
path: path.resolve('www/build/js'),
filename: '[name].bundle.js',
publicPath: "/",
chunkFilename: "[id].bundle.js",
pathinfo: false, // show module paths in the bundle, handy for debugging
},
devtool: 'eval',
module: {
loaders: [
{
test: /\.ts$/,
loader: 'awesome-typescript',
query: {
doTypeCheck: true,
resolveGlobs: false,
externals: ['typings/main.d.ts']
},
include: path.resolve('app'),
exclude: /node_modules/
}
,{
test: /\.js$/,
include: path.resolve('node_modules/angular2'),
loader: 'strip-sourcemap'
}
],
noParse: [
/es6-shim/,
/reflect-metadata/,
/zone\.js(\/|\\)dist(\/|\\)zone/
]
},
plugins: [
new PrefetchPlugin('rxjs'),
new ProvidePlugin({
Chart: 'chart.js/Chart.min.js'
}),
new DedupePlugin()
// ,new UglifyJsPlugin({
// // to debug prod builds uncomment //debug lines and comment //prod lines
// // beautify: true,//debug
// // mangle: false,//debug
// // dead_code: false,//debug
// // unused: false,//debug
// // deadCode: false,//debug
// // compress : { screw_ie8 : true, keep_fnames: true, drop_debugger: false, dead_code: false, unused: false, }, // debug
// // comments: true,//debug
// beautify: false,//prod
// // disable mangling because of a bug in angular2 beta.1, beta.2 and beta.3
// // TODO(mastertinner): enable mangling as soon as angular2 beta.4 is out
// // mangle: { screw_ie8 : true },//prod
// mangle: false,
// // dead_code : true,
// compress : {
// dead_code : true,
// screw_ie8 : true
// },//prod
// comments: false//prod
// })
,new WebpackNotifierPlugin({
title: 'tao_app_ionic',
alwaysNotify: true
// contentImage: path.join(appDir, 'images/notifier.png')
})
],
resolve: {
alias: {
'angular2': path.resolve('node_modules/angular2')
},
extensions: ['', '.js', '.ts']
}
}; |
I am having the same issue, any hack that can fix this for now. |
Before this webpack was using hashes in filenames for the generated files which are stored in memory. That meant on every change new files have been generated and stored in memory, quickly filling up the available memory. With this change we do not use hashes for filenames in development mode to avoid filling up memory. Refs webpack/webpack#1914
Before this webpack was using hashes in filenames for the generated files which are stored in memory. That meant on every change new files have been generated and stored in memory, quickly filling up the available memory. With this change we do not use hashes for filenames in development mode to avoid filling up memory. Refs webpack/webpack#1914 (cherry picked from commit 3ab5918)
Having the same problem running
I'd have thought this would run webpack from scratch each time, but after 5 or so builds I get the out of memory error and have to rerun my gulp file. |
Did someone resolved this problem? |
…n webpack webpack/webpack#1914 is the issue we were seeing.
Another data point here; I have filename hashes disabled and my build isn't terribly large (it uses Angular 2, but few other dependencies), but after about an hour of dev work the watch dies with I've temporarily increased the memory limit, which gives me a lot more time, but I'd rather not be consuming gigabytes just to run a watch command. FYI if anyone is curious about upping the memory limit, I did it like so in my package.json (obviously the additional flags are dependent on your needs): {
"scripts": {
"start": "node --max_old_space_size=4096 node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --progress --port 3000 --open"
}
} |
Having the same issue as @thunderkid here. Any update? |
Same issue for a very small project |
Works for me. |
@idegree I used this for a while, but this broke some programs in Windows. I took for about hour to detect that Geforce Experience does not start because of this environment variable. |
Same with grunt |
Not sure if this is going to help anyone but we had a problem after updating to webpack 4 with the out of memory error. The build itself would often get stuck or become very slow. What very unexpectedly helped us was removing the |
I got this in |
@kevinSuttle +1 I also encounter error in production mode, but not in development |
I had this problem with the version 10.. of node but, when I upgraded to the v12.4.0 the error gone. |
[chunkhash] might cause gc problems: webpack/webpack#1914 see also webpack/webpack#6929
This solution did resolve the problem in my project. |
It solved my problem as well I just had to install "cross-env" pkg and add the node option to the webpack command! Thanks a lot! |
upping the memory limit will only solve the problem temporarily but the RAM being used up the more you rebuild the application. You will notice your machine gets slower overtime. |
remove max_old_space_size just add to ts-loader
|
Update Node versión from v8.16.0 to v12.6.0 and that issue is gone! |
Me too, thanks! @NextTrick |
Memory leak found suguru03/neo-async#83 |
When trying to build the Docker image, I kept receiving an out-of-memory error from Webpack. This issue is apparently explained at webpack/webpack#1914. Several comments in the issue suggested using Node 12 or above. Doing so resolved this issue for me.
When trying to build the Docker image, I kept receiving an out-of-memory error from Webpack. This issue is apparently explained at webpack/webpack#1914. Several comments in the issue suggested using Node 12 or above. Doing so resolved this issue for me. Signed-off-by: Matt Cengia <mattcen@mattcen.com>
Works for me. |
After a couple of builds running in a Watch, Webpack crashes due to being out of memory.
The text was updated successfully, but these errors were encountered: