File tree 2 files changed +21
-0
lines changed
packages/angular_devkit/build_angular
src/angular-cli-files/models/webpack-configs
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
353
353
hints : false ,
354
354
} ,
355
355
module : {
356
+ // Show an error for missing exports instead of a warning.
357
+ strictExportPresence : true ,
356
358
rules : [
357
359
{
358
360
test : / \. ( e o t | s v g | c u r | j p g | p n g | w e b p | g i f | o t f | t t f | w o f f | w o f f 2 | a n i ) $ / ,
Original file line number Diff line number Diff line change @@ -62,4 +62,23 @@ describe('Browser Builder errors', () => {
62
62
expect ( logs . join ( ) ) . toContain ( 'Function expressions are not supported in' ) ;
63
63
await run . stop ( ) ;
64
64
} ) ;
65
+
66
+ it ( 'shows missing export errors' , async ( ) => {
67
+ host . writeMultipleFiles ( {
68
+ 'src/not-main.js' : `
69
+ import { missingExport } from 'rxjs';
70
+ console.log(missingExport);
71
+ ` ,
72
+ } ) ;
73
+ const overrides = { main : 'src/not-main.js' } ;
74
+ const logger = new logging . Logger ( '' ) ;
75
+ const logs : string [ ] = [ ] ;
76
+ logger . subscribe ( e => logs . push ( e . message ) ) ;
77
+
78
+ const run = await architect . scheduleTarget ( targetSpec , overrides , { logger } ) ;
79
+ const output = await run . result ;
80
+ expect ( output . success ) . toBe ( false ) ;
81
+ expect ( logs . join ( ) ) . toContain ( `export 'missingExport' was not found in 'rxjs'` ) ;
82
+ await run . stop ( ) ;
83
+ } ) ;
65
84
} ) ;
You can’t perform that action at this time.
0 commit comments