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

Disallow wildcard export in server entries #46710

Merged
merged 3 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/next-swc/crates/core/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ impl<C: Comments> VisitMut for ServerActions<C> {
disallowed_export_span = *span;
}
},
ModuleItem::ModuleDecl(ModuleDecl::ExportAll(ExportAll { span, .. })) => {
disallowed_export_span = *span;
}
_ => {}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use server';

export * from 'foo'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* __next_internal_action_entry_do_not_use__ */ export * from 'foo';
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

x Only async functions are allowed to be exported in a "use server" file.
,-[input.js:2:1]
2 |
3 | export * from 'foo'
: ^^^^^^^^^^^^^^^^^^^
`----