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

Add an option to ng new to create a zoneless project. #28370

Closed
JeanMeche opened this issue Sep 7, 2024 · 5 comments · Fixed by #28579
Closed

Add an option to ng new to create a zoneless project. #28370

JeanMeche opened this issue Sep 7, 2024 · 5 comments · Fixed by #28579
Labels
area: @schematics/angular feature Issue that requests a new feature

Comments

@JeanMeche
Copy link
Member

Command

new

Description

It'd be great if we could scafold a zoneless project directly from ng new.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

@dgp1130
Copy link
Collaborator

dgp1130 commented Sep 9, 2024

@JeanMeche What exactly does this entail at this point? Is it just removing import 'zone.js'; from polyfills.ts / package.json and adding provideExperimentalZonelessChangeDetection? Should we wait for that API to be stabilized / in dev preview? Is there anything else we'd need to configure?

@atscott is this the right time to be thinking about supporting Zoneless in ng new?

@dgp1130 dgp1130 added feature Issue that requests a new feature area: @schematics/angular labels Sep 9, 2024
@JeanMeche
Copy link
Member Author

JeanMeche commented Sep 10, 2024

Yes, that would be it (and not include provideZoneChangeDetection({ eventCoalescing: true })).

@dgp1130
Copy link
Collaborator

dgp1130 commented Sep 11, 2024

Had a quick conversation within Tooling and with @atscott. We're on board with the idea of something like ng new --zoneless, the question is mainly about timing.

We want to avoid generating experimental code like provideExperimentalZonelessChangeDetection with standard (non-experimental) CLI arguments. Also the SSR story for Zoneless isn't quite figured out yet, so ng new --zoneless --ssr is not likely to generate a usable project.

We think it's probably best to wait until Zoneless is in a stable enough state to start recommending projects consider it. ng new support isn't blocking anything in that effort and adopting Zoneless is relatively straightforward (in the sense of the operations the CLI can do for you).

In the meantime, we're open to an ng new --experimental-zoneless flag since that would at least be clear about the experimental status if anyone wants to contribute it. Otherwise I expect we'll come back to this once Angular is ready to push Zoneless more strongly for new projects.

@aparzi
Copy link
Contributor

aparzi commented Oct 1, 2024

Hi @dgp1130,
I have implemented new option for create zoneless project, but when I test the build in local I run command npm i -D ${path_cli_project}/dist/*.tgz I receive this error:

While resolving: @angular/[email protected] npm ERR! Found: @angular/[email protected] npm ERR! node_modules/@angular/cli npm ERR! dev @angular/cli@"file:../angular-cli/dist/_angular_cli.tgz" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peerOptional @angular/cli@"^19.0.0-next.0" from @angular/[email protected] npm ERR! node_modules/@angular/pwa npm ERR! dev @angular/pwa@"file:../angular-cli/dist/_angular_pwa.tgz" from the root project

Why?

Thanks

@aparzi
Copy link
Contributor

aparzi commented Oct 1, 2024

I added experimental-zoneless in schema.json in ng-new folder but i get message
Error: Unknown argument: experimental-zoneless

When i run ng new project-name --experimental-zoneless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @schematics/angular feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants