fix: fail importing estree-walker with unbuild
yjl9903 opened this issue Β· comments
π The bug
Error trying import ./build.config from /workspaces/Optc Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /workspaces/Optc/node_modules/.pnpm/magic-regexp@0.2.1_vite@3.0.0/node_modules/estree-walker/package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:453:9)
at packageExportsResolve (node:internal/modules/esm/resolve:671: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 (/workspaces/Optc/node_modules/.pnpm/jiti@1.14.0/node_modules/jiti/dist/jiti.js:1:108226)
at jiti (/workspaces/Optc/node_modules/.pnpm/jiti@1.14.0/node_modules/jiti/dist/jiti.js:1:110413)
at /workspaces/Optc/node_modules/.pnpm/magic-regexp@0.2.1_vite@3.0.0/node_modules/magic-regexp/dist/transform.mjs:3:21 {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
π οΈ To reproduce
https://stackblitz.com/edit/github-dpu8mc?file=build.config.ts
π Expected behaviour
It should build.
βΉοΈ Additional context
An issue about estree-walker: Rich-Harris/estree-walker#26
Thanks for the issue! This is definitely my mistake, for documenting unbuild
as working. I've created an issue upstream (unjs/unbuild#92) to track unbuild's support for ESM-only packages within its config.
This should now be resolved in 0.3.0.