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

Error enabling ES modules #30335

Closed
sbfkcel opened this issue Oct 26, 2021 · 5 comments
Closed

Error enabling ES modules #30335

sbfkcel opened this issue Oct 26, 2021 · 5 comments
Labels
bug Issue was opened via the bug report template.

Comments

@sbfkcel
Copy link

sbfkcel commented Oct 26, 2021

What version of Next.js are you using?

12.0

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 dev

Describe the Bug

Snipaste_2021-10-27_01-22-35

Expected Behavior

--

To Reproduce

packages.json

{
  "name": "next",
  "version": "1.0.0",
  "type": "module",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "next": "^12.0.0",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  }
}

next.config.js

export default {

};
yarn

yarn run dev
@sbfkcel sbfkcel added the bug Issue was opened via the bug report template. label Oct 26, 2021
@ijjk
Copy link
Member

ijjk commented Oct 26, 2021

Hi, esm support is enabled by default you should not add type: 'module' to your Next.js project's package.json

@sbfkcel
Copy link
Author

sbfkcel commented Oct 26, 2021

Hi, esm support is enabled by default you should not add type: 'module' to your Next.js project's package.json

next.config.js

Still need to comply with the CMD specification? If you don't add "type":"module", next.config.js will make an error when using ES module.

@rinarakaki
Copy link

The file extension must be .mjs for the time being to enable ESM: next.config.mjs. The full support of "type": "module" is in progress. See #9607 (comment).

@timneutkens
Copy link
Member

As @rnarkk said, this is being tracked in #9607 👍

@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 27, 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

5 participants