unjs / unctx

🍦 Composables in vanilla JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

estree-walker v3 breaks build

CodeDredd opened this issue Β· comments

Error

Cannot start nuxt: No "exports" main defined in /home/dredd/PhpstormProjects/codedredd/pinia-orm/docs/node_modules/nuxt/node_modules/estree-walker/package.json 13:42:34

at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:645:7)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at _resolve (node_modules/jiti/dist/jiti.js:1:108226)
at jiti (node_modules/jiti/dist/jiti.js:1:110413)
at node_modules/nuxt/node_modules/unctx/dist/transform.cjs:7:22

Reason

The reason is simple. As the error displays since v3 of estree-walker the "main" in package.json was removed
See -> Rich-Harris/estree-walker@f7e336f

A PR to fix this already exists but is till now not merged: Rich-Harris/estree-walker#29

Reproduction

https://stackblitz.com/edit/nuxt-starter-vsshdr?file=package.json

Solution (Hot fix)

Move back to v2

PR incoming πŸ˜„

Hi @CodeDredd. What version of Nuxt3 are you using? Do you mind to provide a reproduction please? πŸ™πŸΌ

Hey @pi0 sure. Sorry for not posting it right aways πŸ˜„ . I was using the latest edge version.
https://stackblitz.com/edit/nuxt-starter-vsshdr?file=package.json

I know my solution is the easy one....since estree-walker dropped commonjs support with removing "main". Somehow jiti is not able to handle this correctly.

Still working on framework to trace what places need proper esm import with jiti. In the meantime, please remove lockfile and node_modules and start dev with:

JITI_ESM_RESOLVE=1 npm run dev

Thanks @pi0 . Yeah looked already on your PR for nuxt/framework. I already was confused why native esm was not supported πŸ˜† .
So it seems i still have to find another thing to get my first PR to nuxt, vue, unjs,^^

Okay last missing part was nuxt configuration loader (unjs/c12) to support esm resolution. Updating lockfile again should solve issues.

So it seems i still have to find another thing to get my first PR to nuxt, vue, unjs,^^

Absolutely! Looking forward to your next PR!

I am having this issue also,, just did an nxp nuxi upgrdae --force