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

next dev fails on module is not defined #23276

Closed
JacobLey opened this issue Mar 22, 2021 · 2 comments
Closed

next dev fails on module is not defined #23276

JacobLey opened this issue Mar 22, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@JacobLey
Copy link
Contributor

What version of Next.js are you using?

10.0.10-canary.6

What version of Node.js are you using?

14.16.0

What browser are you using?

Chrome

What operating system are you using?

macOS

How are you deploying your application?

next start

Describe the Bug

If a file is written with ESM syntax (import/export) and is in a directory with "type":"module", NextJS fails to run in development mode.
It attempts to parse the file in the browser and hits a module is not defined error.

Expected Behavior

ESM syntax should be supported (transpiled into CommonJS) in development mode.

To Reproduce

Minimal reproduction: https://github.com/JacobLey/next-dev-module

Add a directory with two files:
package.json with content {"type":"module"}
and foo.js with content export default 'Hello World';

Try loading that foo.js file in any page, and next dev will fail

This behavior is not reproducible with webpack4.

@JacobLey JacobLey added the bug Issue was opened via the bug report template. label Mar 22, 2021
@JacobLey
Copy link
Contributor Author

Actually I believe this is a duplicate of #17806

Will add to conversation there

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants