Home

Issue: 3144

[edge] Using ESM modules in config crashes watcher

[issue link]

Version

edge (2.0.0-25371079.ec5bdd9)

Reproduction link

https://github.com/nuxt/nuxt.js/blob/dev/examples/with-purgecss/nuxt.config.js#L2

Steps to reproduce

  1. Use ESM modules in nuxt.config.js (eg as it was done in the with-purgecss example)
  2. Run npm run dev or nuxt
  3. See the watcher crash

What is expected ?

Build Nuxt as usual

What is actually happening?

The watcher crashes with

/home/mannil/Programming/JS/lichter.io/node_modules/nuxt-edge/bin/nuxt-dev:70
  .watch(nuxtConfigFile(argv), nuxtConfig.watchers.chokidar)
                                                   ^

TypeError: Cannot read property 'chokidar' of undefined
    at Object.<anonymous> (/home/mannil/Programming/JS/lichter.io/node_modules/nuxt-edge/bin/nuxt-dev:70:52)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Module.require (module.js:606:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/mannil/Programming/JS/lichter.io/node_modules/nuxt-edge/bin/nuxt:35:1)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Function.Module.runMain (module.js:703:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:665:3
This bug report is available on Nuxt.js community (#c6785)