Skip to content

Commit

Permalink
export namespace object instead commonjs interop object (#5619)
Browse files Browse the repository at this point in the history
### Description

needed for next.rs API: next.js checks if routes doesn't contain a
default export

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
sokra committed Jul 26, 2023
1 parent 4ef1c93 commit c7e797a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/turbopack-build/src/ecmascript/node/entry/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ impl EcmascriptBuildNodeEntryChunk {
writedoc!(
code,
r#"
module.exports = runtime.getOrInstantiateRuntimeModule({}, CHUNK_PUBLIC_PATH).exports;
const internalModule = runtime.getOrInstantiateRuntimeModule({}, CHUNK_PUBLIC_PATH);
module.exports = internalModule.namespace ?? internalModule.exports;
"#,
StringifyJs(&*runtime_module_id),
)?;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7e797a

Please sign in to comment.