Skip to content

localization retains copyright in minimized main.js #17497

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
sdavids opened this issue Apr 18, 2020 · 2 comments · Fixed by #17625
Closed

localization retains copyright in minimized main.js #17497

sdavids opened this issue Apr 18, 2020 · 2 comments · Fixed by #17625

Comments

@sdavids
Copy link

sdavids commented Apr 18, 2020

🐞 bug report

Affected Package

@angular/localize

Description

When using @angular/localize the Google license will not be removed (extracted) from main.js

🔬 Minimal Reproduction

$ ng n localized --defaults
$ cd localized
$ ng add @angular/localize
$ ng build --prod --localize
$ cat dist/localized/en-US/main-es2015.somehash.js | head -n 9
var $localize=Object.assign(void 0===$localize?{}:$localize,{locale:"en-US"});
/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */
!function(n) ......

🌍 Your Environment

Angular Version:

Angular CLI: 9.1.1
Node: 13.13.0
OS: darwin x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.1
@angular-devkit/build-angular     0.901.1
@angular-devkit/build-optimizer   0.901.1
@angular-devkit/build-webpack     0.901.1
@angular-devkit/core              9.1.1
@angular-devkit/schematics        9.1.1
@angular/cli                      9.1.1
@ngtools/webpack                  9.1.1
@schematics/angular               9.1.1
@schematics/update                0.901.1
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0
@angular/localize 9.1.2

angular.json

{
  "projects": {
    "localized-pwa": {
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "polyfills": "src/polyfills.ts",
            "aot": true,
...
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "extractCss": true,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
...
            }
          }
        }
      }
...
    }},
}
@petebacondarwin
Copy link
Contributor

This is due to the localization process including the global locale data file (e.g. https://github.com/angular/angular/blob/master/packages/common/locales/global/de.js).

It seems that the minification that is being applied to this file (perhaps before or after it is added to main.js) is not stripping the copyright comment (although the other comment is being stripped).

We recently also had an issue that these global locale data files were not being downleveled to ES5 when main.js needed to be ES5.

Perhaps we need to look at how the CLI is adding (and processing) these files. Transferring to the CLI project.

@petebacondarwin petebacondarwin transferred this issue from angular/angular Apr 18, 2020
@ngbot ngbot bot added this to the needsTriage milestone Apr 18, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Apr 18, 2020
clydin added a commit to clydin/angular-cli that referenced this issue May 4, 2020
Locale data is now guaranteed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: angular#17497
clydin added a commit to clydin/angular-cli that referenced this issue May 4, 2020
Locale data is now guaranteed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: angular#17497
clydin added a commit to clydin/angular-cli that referenced this issue May 4, 2020
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: angular#17497
clydin added a commit to clydin/angular-cli that referenced this issue May 4, 2020
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: angular#17497
clydin added a commit to clydin/angular-cli that referenced this issue May 5, 2020
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: angular#17497
dgp1130 pushed a commit that referenced this issue May 6, 2020
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: #17497
filipesilva pushed a commit that referenced this issue May 18, 2020
Locale data is now transformed to be compatible with the ECMAScript level of the application bundles.  The locale data is also optimized to remove comments and unnecessary whitespace.

Fixes: #17497 and Fixes: #17735
@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 Jun 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants