Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@angular-devkit/build-angular): show error for missing modules
Browse files Browse the repository at this point in the history
Fix #14421
filipesilva authored and Keen Yee Liau committed May 15, 2019
1 parent 599bc3e commit d8e0638
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -353,6 +353,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
hints: false,
},
module: {
// Show an error for missing exports instead of a warning.
strictExportPresence: true,
rules: [
{
test: /\.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)$/,
Original file line number Diff line number Diff line change
@@ -62,4 +62,23 @@ describe('Browser Builder errors', () => {
expect(logs.join()).toContain('Function expressions are not supported in');
await run.stop();
});

it('shows missing export errors', async () => {
host.writeMultipleFiles({
'src/not-main.js': `
import { missingExport } from 'rxjs';
console.log(missingExport);
`,
});
const overrides = { main: 'src/not-main.js' };
const logger = new logging.Logger('');
const logs: string[] = [];
logger.subscribe(e => logs.push(e.message));

const run = await architect.scheduleTarget(targetSpec, overrides, { logger });
const output = await run.result;
expect(output.success).toBe(false);
expect(logs.join()).toContain(`export 'missingExport' was not found in 'rxjs'`);
await run.stop();
});
});

0 comments on commit d8e0638

Please sign in to comment.