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

JavaScript heap out of memory during rum my loader via custom-webpack #1344

Open
zxs2162 opened this issue Mar 8, 2023 · 0 comments
Open

Comments

@zxs2162
Copy link

zxs2162 commented Mar 8, 2023

Describe the Bug

After upgraded to 15.0.0 (also Angular 15..1.3)

My build failed.

Then during building: (5 GB memory assigned)
12:14:44 + npm link webpack
12:14:49 /usr/local/bin/webpack -> /usr/local/lib/node_modules/webpack/bin/webpack.js
12:14:49 + webpack@5.75.0
...

12:14:49 + ng build app --configuration production --named-chunks=true
12:14:51 - Generating browser application bundles (phase: setup)...
12:29:29
12:29:29 <--- Last few GCs --->
12:29:29
12:29:29 [171:0x57b5fe0] 870368 ms: Scavenge (reduce) 5049.3 (5094.8) -> 5049.0 (5095.1) MB, 12.6 / 0.0 ms (average mu = 0.360, current mu = 0.363) allocation failure
12:29:29 [171:0x57b5fe0] 870418 ms: Scavenge (reduce) 5049.7 (5092.1) -> 5049.3 (5093.3) MB, 12.5 / 0.0 ms (average mu = 0.360, current mu = 0.363) allocation failure
12:29:29 [171:0x57b5fe0] 870471 ms: Scavenge (reduce) 5049.9 (5095.3) -> 5049.3 (5095.6) MB, 10.4 / 0.0 ms (average mu = 0.360, current mu = 0.363) allocation failure
12:29:29
12:29:29
12:29:29 <--- JS stacktrace --->
12:29:29
12:29:29 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
12:29:29 1: 0xa3ac10 node::Abort()

But everything works well before custom-webpack upgrading to 15(previous version is 13.x)

And, I increase memory to 16GB, build can proceed successfully.

Minimal Reproduction

"builder": "@angular-builders/custom-webpack:browser", ... "customWebpackConfig": { "path": "./my-custom-webpack.config.js", "replaceDuplicatePlugins": true }, - my-custom-webpack.config.js : const path = require('path');

module.exports = {
resolveLoader: {
modules: ['node_modules', './scripts/'],
},
module: {
rules: [
{
test: /.scss$/,
exclude: [/theme.scss$/, /styles.scss$/],
use: [
{
loader: path.resolve('./scripts/my-rtl-webpack-loader.js'),
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
ident: 'postcss',
syntax: 'postcss-scss',
plugins: [require('postcss-rtl'), require('autoprefixer')],
},
},
},
{ loader: 'sass-loader' },
],
},
],
},
};

  • my-rtl-webpack-loader.js

Attention, to minimize the impact, my-rtl-webpack-loader.js will d nothing there!!!

const loaderUtils = require('loader-utils');

module.exports = function (source) {
this.callback(null, source);
};

Expected Behavior

Build should be working with 15.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment


Libs
- @angular/core version: X.Y.Z
- @angular-devkit/build-angular version: X.Y.Z
- @angular-builders/{the name of the builder} version: X.Y.Z

For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Additional Context

Add any other context about the problem here.

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

1 participant