Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix "Must use import to load ES Module"
The actual error message was: > ERROR Must use import to load ES Module: /Users/kana/working/hatokurandom/node_modules/lodash-es/lodash.js > require() of ES modules is not supported. > require() of /Users/kana/working/hatokurandom/node_modules/lodash-es/lodash.js from /Users/kana/working/hatokurandom/lib/utils.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. > Instead rename lodash.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/kana/working/hatokurandom/node_modules/lodash-es/package.json. According to nuxt/nuxt#6718 (comment) > Hi. Just as an update, we are working on next gen server for nuxt3 > (backported to nuxt2) which is using RollupJS to bundle > server-middleware and natively supports mjs. In the meantime you can > migrate from esm to jiti by setting this in nuxt.config:
- Loading branch information