Skip to content

fix(@angular-devkit/build-angular): show error for missing modules #14435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)$/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});