Skip to content

Commit 27a3c4b

Browse files
committed
feat(@angular-devkit/build-angular): favor ESM over FESM bundles
Fix angular#13635
1 parent 6fc6e84 commit 27a3c4b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/models/webpack-configs/browser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ export function getBrowserConfig(wco: WebpackConfigOptions) {
8080
devtool: isEval ? 'eval' : false,
8181
resolve: {
8282
mainFields: [
83-
...(wco.supportES2015 ? ['es2015'] : []),
84-
'browser', 'module', 'main',
83+
...(wco.supportES2015 ? ['es2015', 'fesm2015'] : []),
84+
'esm5', 'fesm5', 'browser', 'module', 'main',
8585
],
8686
},
8787
output: {

packages/angular_devkit/build_angular/test/browser/works_spec_large.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import { runTargetSpec } from '@angular-devkit/architect/testing';
9+
import { DefaultTimeout, TestLogger, runTargetSpec } from '@angular-devkit/architect/testing';
1010
import { join, normalize } from '@angular-devkit/core';
1111
import { tap } from 'rxjs/operators';
1212
import { browserTargetSpec, host } from '../utils';
@@ -19,7 +19,9 @@ describe('Browser Builder basic test', () => {
1919
afterEach(done => host.restore().toPromise().then(done, done.fail));
2020

2121
it('works', (done) => {
22-
runTargetSpec(host, browserTargetSpec).pipe(
22+
const logger = new TestLogger('rebuild-type-errors');
23+
24+
runTargetSpec(host, browserTargetSpec, {}, DefaultTimeout, logger).pipe(
2325
tap((buildEvent) => expect(buildEvent.success).toBe(true)),
2426
tap(() => {
2527
// Default files should be in outputPath.
@@ -31,6 +33,8 @@ describe('Browser Builder basic test', () => {
3133
expect(host.scopedSync().exists(join(outputPath, 'favicon.ico'))).toBe(true);
3234
expect(host.scopedSync().exists(join(outputPath, 'index.html'))).toBe(true);
3335
}),
36+
tap(() => expect(logger.includes('WARNING')).toBe(false, 'Should have no warnings.')),
37+
tap(() => expect(logger.includes('ERROR')).toBe(false, 'Should have no errors.')),
3438
).toPromise().then(done, done.fail);
3539
});
3640
});

0 commit comments

Comments
 (0)