next dev
fails on module is not defined
#23276
Labels
bug
Issue was opened via the bug report template.
next dev
fails on module is not defined
#23276
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 contentexport default 'Hello World';
Try loading that
foo.js
file in any page, andnext dev
will failThis behavior is not reproducible with webpack4.
The text was updated successfully, but these errors were encountered: