Skip to content

Auto include @angular/platform-server/init and @angular/localize/init #24032

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

Merged

Conversation

alan-agius4
Copy link
Collaborator

feat(@angular-devkit/build-angular): auto include @angular/platform-server/init during server builds

This changes removes the need to import @angular/platform-server/init in the main.server.ts instead we now include this as an entry-point when we are bundling as server bundle.


feat(@angular-devkit/build-angular): auto include @angular/localize/init when found in types

With this change we remove the need to include the @angular/localize/init package as polyfills in polyfills.ts, angular.json and main.server.ts.

@angular-robot angular-robot bot added the feature Issue that requests a new feature label Oct 7, 2022
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Oct 7, 2022
@alan-agius4 alan-agius4 requested a review from clydin October 7, 2022 10:07
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 7, 2022
@alan-agius4 alan-agius4 added this to the v15 Feature Freeze milestone Oct 11, 2022
…init` when found in `types`

With this change we remove the need to include the `@angular/localize/init` package as polyfills in `polyfills.ts`, `angular.json` and `main.server.ts`.

Instead when `@angular/localize/init` is included in the TypeScript `types` we add this as entry-point. The `@angular/localize/init` will be added as a parts of the `types` array in a seperate PR to address angular/angular#47677 which is caused by the fact that `@angular/localize/init` types are no longer imported when `@angular/localize/init` is added as a polyfill in `angular.json`.
…server/init` during server builds

This changes removes the need to import `@angular/platform-server/init` in the `main.server.ts` instead we now include this as an entry-point when we are bundling as server bundle.
@alan-agius4 alan-agius4 force-pushed the auto-import-server-and-localize-init branch from f5a2384 to 02ce4d8 Compare October 12, 2022 06:05
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 12, 2022
@alan-agius4 alan-agius4 merged commit 979bce4 into angular:main Oct 12, 2022
@alan-agius4 alan-agius4 deleted the auto-import-server-and-localize-init branch October 12, 2022 06:57
alan-agius4 added a commit to alan-agius4/angular that referenced this pull request Oct 14, 2022
Prior to this, the `@angular/localize/init` was added as a polyfill which caused the `@angular/localize` types not to be included in the TypeScript program which caused errors such as the below:

```
Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.
```

With the recent changes in the CLI (angular/angular-cli#24032), adding `@angular/localize/init` as polyfil or in the `main.server.ts` is no longer necessary. Instead we add this as a TypeScript type. When users are running in JIT mode, we add `@angular/localize/init` as an additional entrypoint.

This change also exposes the `$localize` method as a global when importing `@angular/localize`.

Closes angular#47677
dylhunn pushed a commit to angular/angular that referenced this pull request Oct 17, 2022
… 15 (#47763)

Prior to this, the `@angular/localize/init` was added as a polyfill which caused the `@angular/localize` types not to be included in the TypeScript program which caused errors such as the below:

```
Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.
```

With the recent changes in the CLI (angular/angular-cli#24032), adding `@angular/localize/init` as polyfil or in the `main.server.ts` is no longer necessary. Instead we add this as a TypeScript type. When users are running in JIT mode, we add `@angular/localize/init` as an additional entrypoint.

This change also exposes the `$localize` method as a global when importing `@angular/localize`.

Closes #47677

PR Close #47763
dylhunn pushed a commit to angular/angular that referenced this pull request Oct 17, 2022
… 15 (#47763)

Prior to this, the `@angular/localize/init` was added as a polyfill which caused the `@angular/localize` types not to be included in the TypeScript program which caused errors such as the below:

```
Error: src/app/app.component.ts:9:11 - error TS2304: Cannot find name '$localize'.
```

With the recent changes in the CLI (angular/angular-cli#24032), adding `@angular/localize/init` as polyfil or in the `main.server.ts` is no longer necessary. Instead we add this as a TypeScript type. When users are running in JIT mode, we add `@angular/localize/init` as an additional entrypoint.

This change also exposes the `$localize` method as a global when importing `@angular/localize`.

Closes #47677

PR Close #47763
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker feature Issue that requests a new feature target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants