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

Angular-cli does not compile vendor dependencies #14429

Closed
MatissJanis opened this issue May 15, 2019 · 2 comments
Closed

Angular-cli does not compile vendor dependencies #14429

MatissJanis opened this issue May 15, 2019 · 2 comments

Comments

@MatissJanis
Copy link

🐞 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?

Not sure.

Description

When doing ng build on a project that is using a dependency that's compiled with es6, the output contains es6 code which makes older browsers break. See example below to understand this better.

🔬 Minimal Reproduction

  1. Add a dependency that is NOT bundled to es5 (for example messageformat): https://github.com/MatissJanis/angular-cli-issue/commit/a406b57b5e3c40b8360a269c64177d32edc5ae86
  2. Do ng build or ng build --prod
  3. Check source code and you will notice template literal syntax here: https://github.com/MatissJanis/angular-cli-issue/blob/master/dist/test-ang/vendor.js

(the file is really large, please search for ${fn}(${args.join(', ')}) to see the issue)

Here's example screenshot of something that should NOT be in the build (since it makes IE11 and the like break).

Screenshot 2019-05-15 at 10 46 47

🔥 Exception or Error





🌍 Your Environment



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


Angular CLI: 6.2.9
Node: 12.1.0
OS: darwin x64
Angular: 6.1.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.9
@angular-devkit/build-angular     0.8.9
@angular-devkit/build-optimizer   0.8.9
@angular-devkit/build-webpack     0.8.9
@angular-devkit/core              0.8.9
@angular-devkit/schematics        0.8.9
@angular/cli                      6.2.9
@ngtools/webpack                  6.2.9
@schematics/angular               0.8.9
@schematics/update                0.8.9
rxjs                              6.2.2
typescript                        2.9.2
webpack                           4.16.4

Anything else relevant?

@alan-agius4
Copy link
Collaborator

Hi, Angular-CLI doesn't down-level 3rd party JavaScript.

Libraries that are meant to support older browser versions are meant to ship both ES2015 and ES5 code. And it will be up to the build system to determine which on to use.

See https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview#heading=h.k0mh3o8u5hx for more details.

This is very similar to #12975 (comment), insofar as we do not error if ES6 libraries are used when targetting ES5.

I think #12975 should be the main issue where third party libraries in ES2015 are discussed instead of having a fragmented discussion across multiple issues.

Thanks.

@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 Sep 9, 2019
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

2 participants