File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
packages/angular_devkit/build_angular
src/angular-cli-files/models/webpack-configs Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
359359 hints : false ,
360360 } ,
361361 module : {
362+ // Show an error for missing exports instead of a warning.
363+ strictExportPresence : true ,
362364 rules : [
363365 {
364366 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', () => {
6262 expect ( logs . join ( ) ) . toContain ( 'Function expressions are not supported in' ) ;
6363 await run . stop ( ) ;
6464 } ) ;
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+ } ) ;
6584} ) ;
You can’t perform that action at this time.
0 commit comments