Skip to content

ng build --watch can not load some old es5 librares #15102

@steve3d

Description

@steve3d

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

@angular/cli<8.1.0 are good, so I think it is

Description

I'm using angular with laravel, so I can not directly use ng serve to test my site, but after I upgrade angular to 8.1.0, I found that ng build --watch can not work, before the upgrade, it's fine.

🔬 Minimal Reproduction

steps to reproduction:

  • cd webroot folder
  • ng new test-app
  • npm add -D holderjs
  • add "node_modules/holderjs/holder.min.js" to angular.json's scripts part
  • change base tag in index.html to something like /test-app/dist/test-app/, and it must be the correct folder
  • ng build --watch
  • open url like https://localhost/test-app/dist/test-app then, you will find that holderjs can not be loaded, because, there is no window object exists when running the holder.min.js

but if I use ng serve, then holderjs will NOT throw any error. this only happens when I'm using --watch

🌍 Your Environment

Angular CLI: 8.1.1
Node: 10.16.0
OS: darwin x64
Angular: 8.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.1
@angular-devkit/build-angular     0.801.1
@angular-devkit/build-optimizer   0.801.1
@angular-devkit/build-webpack     0.801.1
@angular-devkit/core              8.1.1
@angular-devkit/schematics        8.1.1
@ngtools/webpack                  8.1.1
@schematics/angular               8.1.1
@schematics/update                0.801.1
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.35.2

Anything else relevant?
no

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions