Skip to content
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();
});
});