angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Differential loading produces ES5 for new Edge with Yarn

Open anton-gorbikov opened this issue 6 years ago • 3 comments

🐞 Bug report

Command (mark with an x)

  • [ ] new
  • [x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

No

Description

Depending on package manager (NPM or Yarn) Angular CLI treats Edge 79/80 as ES2015 (NPM) or ES5 (Yarn) compatible browser.

🔬 Minimal Reproduction

  1. Create new empty project:
    npx -p @angular/cli ng new edge
    
  2. Replace browserslist content with only one line (Edge 79/80)
    last 2 Edge versions
    
  3. Remove node_modules and lock files, install dependencies from scratch by NPM:
    npm i
    npm run ng build --prod
    
  4. Build the project (no ES5 bundle): image
  5. Do the same for Yarn, remove node_modules:
    yarn
    yarn ng build --prod
    
  6. Build the project (ES5 bundle generated): image

🌍 Your Environment


$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.3
Node: 13.7.0
OS: win32 x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.3
@angular-devkit/build-angular     0.900.3
@angular-devkit/build-optimizer   0.900.3
@angular-devkit/build-webpack     0.900.3
@angular-devkit/core              9.0.3
@angular-devkit/schematics        9.0.3
@angular/cli                      9.0.3
@ngtools/webpack                  9.0.3
@schematics/angular               9.0.3
@schematics/update                0.900.3
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Done in 1.22s.

yarn version v1.21.1

Anything else relevant?

anton-gorbikov avatar Feb 25 '20 07:02 anton-gorbikov

This seems to be caused by dependency hoisting issues and the inconsistency between yarn and npm.

last 2 Edge versions in npm will return  [ 'edge 78', 'edge 80' ]
last 2 Edge versions in yarn will return  [ 'edge 18', 'edge 17' ]

alan-agius4 avatar Feb 25 '20 07:02 alan-agius4

Does this also cause that edge will load the 2015 modules? And thus crash with destructuring?

sandrooco avatar Apr 02 '20 15:04 sandrooco

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.