@angular-devkit/build-angular 13.2.2 → 13.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-angular",
3
- "version": "13.2.2",
3
+ "version": "13.2.3",
4
4
  "description": "Angular Webpack Build Facade",
5
5
  "main": "src/index.js",
6
6
  "typings": "src/index.d.ts",
7
7
  "builders": "builders.json",
8
8
  "dependencies": {
9
9
  "@ampproject/remapping": "1.1.1",
10
- "@angular-devkit/architect": "0.1302.2",
11
- "@angular-devkit/build-webpack": "0.1302.2",
12
- "@angular-devkit/core": "13.2.2",
10
+ "@angular-devkit/architect": "0.1302.3",
11
+ "@angular-devkit/build-webpack": "0.1302.3",
12
+ "@angular-devkit/core": "13.2.3",
13
13
  "@babel/core": "7.16.12",
14
14
  "@babel/generator": "7.16.8",
15
15
  "@babel/helper-annotate-as-pure": "7.16.7",
@@ -20,7 +20,7 @@
20
20
  "@babel/runtime": "7.16.7",
21
21
  "@babel/template": "7.16.7",
22
22
  "@discoveryjs/json-ext": "0.5.6",
23
- "@ngtools/webpack": "13.2.2",
23
+ "@ngtools/webpack": "13.2.3",
24
24
  "ansi-colors": "4.1.1",
25
25
  "babel-loader": "8.2.3",
26
26
  "babel-plugin-istanbul": "6.1.1",
@@ -155,27 +155,38 @@ const init = (config, emitter) => {
155
155
  compiler.hooks.invalid.tap('karma', () => handler());
156
156
  compiler.hooks.watchRun.tapAsync('karma', (_, callback) => handler(callback));
157
157
  compiler.hooks.run.tapAsync('karma', (_, callback) => handler(callback));
158
+ webpackMiddleware = (0, webpack_dev_middleware_1.default)(compiler, webpackMiddlewareConfig);
159
+ emitter.on('exit', (done) => {
160
+ webpackMiddleware.close();
161
+ done();
162
+ });
158
163
  function unblock() {
159
164
  isBlocked = false;
160
165
  blocked.forEach((cb) => cb());
161
166
  blocked = [];
162
167
  }
163
168
  let lastCompilationHash;
164
- compiler.hooks.done.tap('karma', (stats) => {
165
- if (stats.hasErrors()) {
166
- lastCompilationHash = undefined;
167
- }
168
- else if (stats.hash != lastCompilationHash) {
169
- // Refresh karma only when there are no webpack errors, and if the compilation changed.
170
- lastCompilationHash = stats.hash;
171
- emitter.refreshFiles();
172
- }
173
- unblock();
174
- });
175
- webpackMiddleware = (0, webpack_dev_middleware_1.default)(compiler, webpackMiddlewareConfig);
176
- emitter.on('exit', (done) => {
177
- webpackMiddleware.close();
178
- done();
169
+ let isFirstRun = true;
170
+ return new Promise((resolve) => {
171
+ compiler.hooks.done.tap('karma', (stats) => {
172
+ if (isFirstRun) {
173
+ // This is needed to block Karma from launching browsers before Webpack writes the assets in memory.
174
+ // See the below:
175
+ // https://github.com/karma-runner/karma-chrome-launcher/issues/154#issuecomment-986661937
176
+ // https://github.com/angular/angular-cli/issues/22495
177
+ isFirstRun = false;
178
+ resolve();
179
+ }
180
+ if (stats.hasErrors()) {
181
+ lastCompilationHash = undefined;
182
+ }
183
+ else if (stats.hash != lastCompilationHash) {
184
+ // Refresh karma only when there are no webpack errors, and if the compilation changed.
185
+ lastCompilationHash = stats.hash;
186
+ emitter.refreshFiles();
187
+ }
188
+ unblock();
189
+ });
179
190
  });
180
191
  };
181
192
  init.$inject = ['config', 'emitter'];