Skip to content

Commit a5bf224

Browse files
committed
refactor(@angular-devkit/build-angular): use ES6 imports instead of require
Main benefit is to use type definitions.
1 parent b8336b2 commit a5bf224

File tree

1 file changed

+5
-5
lines changed
  • packages/angular_devkit/build_angular/src/dev-server

1 file changed

+5
-5
lines changed

packages/angular_devkit/build_angular/src/dev-server/index.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from '@angular-devkit/build-webpack';
1515
import { json, tags } from '@angular-devkit/core';
1616
import * as path from 'path';
17-
import { Observable, from, of } from 'rxjs';
17+
import { Observable, from } from 'rxjs';
1818
import { concatMap, switchMap } from 'rxjs/operators';
1919
import * as ts from 'typescript';
2020
import * as url from 'url';
@@ -307,7 +307,7 @@ export function serveWebpackBrowser(
307307
webpackDevServerFactory: require('webpack-dev-server') as typeof webpackDevServer,
308308
},
309309
).pipe(
310-
concatMap((buildEvent, index) => {
310+
concatMap(async (buildEvent, index) => {
311311
// Resolve serve address.
312312
const serverAddress = url.format({
313313
protocol: options.ssl ? 'https' : 'http',
@@ -325,16 +325,16 @@ export function serveWebpackBrowser(
325325
` + '\n');
326326

327327
if (options.open) {
328-
const open = require('open');
329-
open(serverAddress);
328+
const open = await import('open');
329+
await open(serverAddress);
330330
}
331331
}
332332

333333
if (buildEvent.success) {
334334
logger.info(`\n${colors.greenBright(colors.symbols.check)} Compiled successfully.`);
335335
}
336336

337-
return of({ ...buildEvent, baseUrl: serverAddress } as DevServerBuilderOutput);
337+
return { ...buildEvent, baseUrl: serverAddress } as DevServerBuilderOutput;
338338
}),
339339
);
340340
}),

0 commit comments

Comments
 (0)