Skip to content

Commit 871eb69

Browse files
Alanmgechev
authored andcommitted
fix(@ngtools/webpack): replace resources should return class node when modified
This is also the root cause of spec large fail occasionally as we keep checking the child class nodes
1 parent 54d2be9 commit 871eb69

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/ngtools/webpack/src/transformers/replace_resources.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,22 @@ export function replaceResources(
1818

1919
const visitNode: ts.Visitor = (node: ts.Decorator) => {
2020
if (ts.isClassDeclaration(node)) {
21-
node.decorators = ts.visitNodes(
21+
const decorators = ts.visitNodes(
2222
node.decorators,
2323
(node: ts.Decorator) => visitDecorator(node, typeChecker, directTemplateLoading),
2424
);
25+
26+
// todo: we need to investigate and confirm that using
27+
// `updateClassDeclaration` has no regressions
28+
return ts.updateClassDeclaration(
29+
node,
30+
decorators,
31+
node.modifiers,
32+
node.name,
33+
node.typeParameters,
34+
node.heritageClauses,
35+
node.members,
36+
);
2537
}
2638

2739
return ts.visitEachChild(node, visitNode, context);

0 commit comments

Comments
 (0)