[edge] nuxt.config.js in ESM style throws error

Versions

Reproduction

  • yarn create nuxt-app rm-test
  • cd rm-test
  • yarn remove nuxt && yarn add nuxt-edge
  • yarn dev
  • See error.
Additional Details

yarn run v1.22.5
$ nuxt

 FATAL  Unexpected token 'export'                                                                                                                                                                                                                   11:56:35

  export default {
  ^^^^^^

  SyntaxError: Unexpected token 'export'
  at wrapSafe (internal/modules/cjs/loader.js:1071:16)
  at Module._compile (internal/modules/cjs/loader.js:1121:27)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1177:10)
  at Module.load (internal/modules/cjs/loader.js:1001:32)
  at Function.Module._load (internal/modules/cjs/loader.js:900:14)
  at Module.require (internal/modules/cjs/loader.js:1043:19)
  at require (internal/modules/cjs/helpers.js:77:18)
  at Object.loadNuxtConfig (node_modules/@nuxt/config-edge/dist/config.js:1053:15)
  at loadNuxtConfig (node_modules/@nuxt/cli-edge/dist/cli-index.js:338:36)
  at NuxtCommand.getNuxtConfig (node_modules/@nuxt/cli-edge/dist/cli-index.js:463:26)


   ╭────────────────────────────────────────────╮
   │                                            │
   │   ✖ Nuxt Fatal Error                       │
   │                                            │
   │   SyntaxError: Unexpected token 'export'   │
   │                                            │
   ╰────────────────────────────────────────────╯

error Command failed with exit code 1.

What is Expected?

Having the config file in ESM syntax being a legit way 😋

What is actually happening?

Error is being thrown.

1 possible answer(s) on “[edge] nuxt.config.js in ESM style throws error