Skip to content

Webpack watch with AOT, builds are inconsistent #12621

@henk23

Description

@henk23

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Possibly related to #11835.

Command (mark with an x)

- [x] @ngtools/webpack / AngularCompilerPlugin (Hope this issue belongs here since https://www.npmjs.com/package/@ngtools/webpack links to this repo)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node version: v8.12.0
npm version: 6.4.1
webpack version: 4.20.2
OS: macOS Sierra 10.12.6
Angular CLI: not used

Repro steps

  1. Checkout minimal test repo: https://github.com/henk23/webpack-bug-test
  2. Install dependencies and run webpack: npm install && node_modules/.bin/webpack -d -w
  3. Open a local web server in the dist directory to load the resulting index.html. The app should load fine and display something in the console.
  4. Change and Ctrl+S in any project file triggers 2nd build. Everything should still be fine.
  5. Change and Ctrl+S in any project file triggers 3rd build. There will be an error in the browser console now: "Error: AngularJS v1.x is not loaded!"

The log given by the failure

There is no error in the build process. But you can see the line

[./src/app/app.module.ngfactory.js] 6.98 KiB {main} [built]

in the output of the 3rd build which is unexpected since the module was not changed and the line does not appear in the 2nd build.

Desired functionality

The resulting app should be the same on every consecutive build.

Mention any other details that might be useful

Downgrading any of the dependencies to 6.1.1 or even 6.0.0 as suggested in #11835 does not resolve the issue.
The issue does not appear when using JIT with skipCodeGeneration: true in the AngularCompilerPlugin.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions