Skip to content

Commit 653cf4a

Browse files
authored
fix(next-custom-transforms): preserve all declarators in multi-declarator export statements (#86552)
1 parent b8b62f1 commit 653cf4a

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

crates/next-custom-transforms/src/transforms/next_ssg.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ impl VisitMut for Analyzer<'_> {
144144
return;
145145
}
146146

147-
if let Pat::Ident(id) = &d.decls[0].name {
148-
if !SSG_EXPORTS.contains(&&*id.id.sym) {
149-
self.add_ref(id.to_id());
147+
for decl in &d.decls {
148+
if let Pat::Ident(id) = &decl.name {
149+
if !SSG_EXPORTS.contains(&&*id.id.sym) {
150+
self.add_ref(id.to_id());
151+
}
150152
}
151153
}
152154
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export const a = 1,
2+
b = 2
3+
4+
export async function getStaticProps() {
5+
return {
6+
props: {
7+
sum: a + b,
8+
},
9+
}
10+
}
11+
12+
export default function Page() {
13+
return <div>Test</div>
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export var __N_SSG = true;
2+
export const a = 1, b = 2;
3+
export default function Page() {
4+
return __jsx("div", null, "Test");
5+
}

0 commit comments

Comments
 (0)