Skip to content
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

Exclude 'babel-plugin-compact-reexports' during Stage 1 build #690

Merged
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
13 changes: 13 additions & 0 deletions packages/compat/src/detect-compact-reexports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { PluginItem } from '@babel/core';

export function isCompactReexports(item: PluginItem): boolean {
let pluginPath: string;
if (typeof item === 'string') {
pluginPath = item;
} else if (Array.isArray(item) && item.length > 0 && typeof item[0] === 'string') {
pluginPath = item[0];
} else {
return false;
}
return /(^|\/)babel-plugin-compact-reexports\//.test(pluginPath);
}
7 changes: 7 additions & 0 deletions packages/compat/src/v1-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import modulesCompat from './modules-compat';
import writeFile from 'broccoli-file-creator';
import SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';
import { isEmberAutoImportDynamic } from './detect-ember-auto-import';
import { isCompactReexports } from './detect-compact-reexports';
import { ResolvedDep } from '@embroider/core/src/resolver';

const stockTreeNames = Object.freeze([
Expand Down Expand Up @@ -1006,6 +1007,12 @@ function babelPluginAllowedInStage1(plugin: PluginItem) {
return false;
}

if (isCompactReexports(plugin)) {
// We don't want to replace re-exports at this stage, since that will turn
// an `export` statement into a `define`, which is handled in Stage 3
return false;
}

return true;
}

Expand Down