Skip to content

Commit

Permalink
fix(plugin): when updating import/export paths, clone original flags
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Sep 12, 2022
1 parent 1920c2b commit 2db3b5b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/compiler/hooks/tsconfig-paths.hook.ts
Expand Up @@ -45,7 +45,7 @@ export function tsconfigPathsBeforeHookFactory(
).moduleSpecifier.parent;

if (tsBinary.isImportDeclaration(node)) {
return isInUpdatedAstContext
const updatedNode = isInUpdatedAstContext
? (tsBinary.factory as any).updateImportDeclaration(
node,
node.modifiers,
Expand All @@ -61,8 +61,10 @@ export function tsconfigPathsBeforeHookFactory(
moduleSpecifier,
node.assertClause,
);
(updatedNode as any).flags = node.flags;
return updatedNode;
} else {
return isInUpdatedAstContext
const updatedNode = isInUpdatedAstContext
? (tsBinary.factory as any).updateExportDeclaration(
node,
node.modifiers,
Expand All @@ -80,6 +82,8 @@ export function tsconfigPathsBeforeHookFactory(
moduleSpecifier,
node.assertClause,
);
(updatedNode as any).flags = node.flags;
return updatedNode;
}
} catch {
return node;
Expand Down

0 comments on commit 2db3b5b

Please sign in to comment.