Skip to content

Importing locales can cause optimization bailouts #18212

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

Closed
snebjorn opened this issue Jul 10, 2020 · 3 comments
Closed

Importing locales can cause optimization bailouts #18212

snebjorn opened this issue Jul 10, 2020 · 3 comments

Comments

@snebjorn
Copy link

🐞 bug report

Affected Package

The issue is caused by package @angular/common/locales

Is this a regression?

Yes, the previous version in which this bug was not present was: 9.1.11

Description

Importing a locale for use with registerLocaleData causes angular 10 to complain:

CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

🔬 Minimal Reproduction

// app.module.ts
import locale from '@angular/common/locales/da';

Run: ng serve

🌍 Your Environment

Angular Version:


Angular CLI: 10.0.1
Node: 12.16.1
OS: win32 x64

Angular: 10.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.1000.1
@angular-devkit/build-optimizer   0.1000.1
@angular-devkit/build-webpack     0.1000.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        10.0.1
@angular/cdk                      9.2.4
@angular/cli                      10.0.1
@ngtools/webpack                  10.0.1
@schematics/angular               10.0.1
@schematics/update                0.1000.1
rxjs                              6.6.0
typescript                        3.9.6
webpack                           4.43.0

Anything else relevant?
Switching to @angular/localize and adding

// angular.json
{
  ...,
  "projects": {
    ...,
    "i18n": { "sourceLocale": "da" }, // added
    "architect": {
        "build": {
          "options": {
            ...,
            "localize": true, // added

removes the warning.
But is overkill and causes the compile out dir to change, breaking the CI scripts etc...

@destus90
Copy link
Contributor

With CLI version 10.0.2 the warning should not be displayed, due to #18134

@alan-agius4 alan-agius4 transferred this issue from angular/angular Jul 10, 2020
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jul 10, 2020

Duplicate of #18123

@alan-agius4 alan-agius4 marked this as a duplicate of #18123 Jul 10, 2020
@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 Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants