.js file extension not recognized in bundler for Typescript files #59744
Labels
bug
Issue was opened via the bug report template.
linear: next
Confirmed issue that is tracked by the Next.js team.
TypeScript
Related to types with Next.js.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/affectionate-satoshi-xk5gqp
To Reproduce
.js
file extension required to conform with ES Modules syntaxnext build
Current vs. Expected behavior
.js
extension in a project that must conform to ES modules spec (namely to run in Node properly)current:
expected:
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, TypeScript (plugin, built-in types)
Additional context
This is the same problem as reported in this issue:
#33056
which was closed as being a duplicate of a "discussion":
#32237
re-opening it as an issue since it's a bug in the build system that should be fixed
Some additional challenges with this:
getServerSideProps
are subject to working properly in the Node ESM resolver since that's what the Pages build system is using.js
extensions present in their source files in order to work correctly in Next.js
extensions in order to work, while currently any application code must not include those extensions in order to work. It should work in both places..js
extension isn't recognized in either App Router or Pages Router for serverside codeNEXT-2779
The text was updated successfully, but these errors were encountered: