Giter Club home page Giter Club logo

Comments (4)

dereklin avatar dereklin commented on July 26, 2024 2

How to do the equivalent of this?:

node --max-old-space-size=8192 node_modules/@angular/compiler-cli/src/main.js -p tsconfig-aot.json

from ngc-webpack.

markkasaboski avatar markkasaboski commented on July 26, 2024 1

Sadly, the above solution won't work for everyone. The memory consumption is obscene to say the least. I've even gone as far as:

node --max_old_space_size=8192 --optimize_for_size --max_executable_size=8192 --stack_size=8192 /usr/local/bin/npm run build

What we need is what Google is using internally and we need it yesterday! angular/angular#12184 (comment)

from ngc-webpack.

shlomiassaf avatar shlomiassaf commented on July 26, 2024

The plugin essentially move things from there to there, the core functionality is in the angular compiler.

Can you please give more details on the setup and project, maybe something to reproduce

from ngc-webpack.

Koslun avatar Koslun commented on July 26, 2024

Have a medium sized app with about 5 lazy-loaded modules and 78 defined components and maybe about 10 forms. It has been stuck on 2.1.1 in JiT mode largely due to depending on the earlier version of Angular Universal.

So have recently been porting it to 4.1.X and AoT using the new Angular Universal project. In this process I have also been seeing the exact same error thrown.

I believe it to be an optimization issue with the angular compiler. Specifically one issue on the angular repo, angular/angular#12184, eventually starts to discuss that the compiler can sometimes use a whole lot of memory, core members chiming in.

The only other one I've seen to actually pin-point a specific possible cause other than "big projects => bad" has to do with the number of form controls in your app 20-30 being bad: angular/angular#11458. It however derails a bit and got locked. Nevertheless it would at least apply to our project, in particular it seems that it is our lazy loaded modules which explode, which is also where all of our forms are. To be specific we use the ReactiveFormModule and not the template-based form module.

The only actionable solution I've found is the one mentioned by @dereklin, allow node to use more RAM. Discussed more in depth in angular/angular#5229 and previously linked issue angular/angular#12184.

Translating the above solution to a gulp project should be to run gulp through node, i.e.:

node --max_old_space_size=4000 node_modules/gulp/bin/gulp.js [<task>]

If you run webpack through the CLI using npm scripts, like almost all starters I've seen, I imagine it'd be something similar for webpack.

So I derailed a lot but think the only real change that can be done in this project would be to add a note of this workaround in the README.md as this needs to be optimized downstream at the angular compiler, as noted by Tobias Bosch in angular/angular#12184 (comment).

from ngc-webpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.