Skip to content

Commit

Permalink
unique import across all modules
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett committed Mar 11, 2024
1 parent 621ac1b commit c356620
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/transformers/typescript-types/src/TSModuleGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ export class TSModuleGraph {
modules: Map<string, TSModule>;
mainModuleName: string;
mainModule: ?TSModule;
syntheticImportCount: number;

constructor(mainModuleName: string) {
this.modules = new Map();
this.mainModuleName = mainModuleName;
this.mainModule = null;
this.syntheticImportCount = 0;
}

addModule(name: string, module: TSModule) {
Expand Down
2 changes: 1 addition & 1 deletion packages/transformers/typescript-types/src/collect.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function collect(
ts.isLiteralTypeNode(node.argument) &&
ts.isStringLiteral(node.argument.literal)
) {
let local = `$$parcel$import$${currentModule.imports.size}`;
let local = `$$parcel$import$${moduleGraph.syntheticImportCount++}`;
if (node.qualifier) {
currentModule.addImport(
local,
Expand Down

0 comments on commit c356620

Please sign in to comment.