ERR_PACKAGE_PATH_NOT_EXPORTED
thetarnav opened this issue · 3 comments
thetarnav commented
Updating to 3.1.2
from 3.1.1
resulted in following error when using the plugin with jiti
:
> jiti ./scripts/generate.ts
...\solid-primitives\node_modules\.pnpm\jiti@1.19.1\node_modules\jiti\lib\index.js:2
throw err; /* ↓ Check stack trace ↓ */
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ...\solid-primitives\site\node_modules\remark-emoji\package.json
at new NodeError (node:internal/errors:399:5)
at exportsNotFound (node:internal/modules/esm/resolve:361:10)
at packageExportsResolve (node:internal/modules/esm/resolve:641:13)
at Module._findPath (node:internal/modules/cjs/loader:634:31)
at Module._resolveFilename (node:internal/modules/cjs/loader:1061:27)
at Function.resolve (node:internal/modules/cjs/helpers:116:19)
at _resolve (...\solid-primitives\node_modules\.pnpm\jiti@1.19.1\node_modules\jiti\dist\jiti.js:1:250100)
at jiti (...\solid-primitives\node_modules\.pnpm\jiti@1.19.1\node_modules\jiti\dist\jiti.js:1:252409)
at ...\solid-primitives\site\scripts\generate.ts:12:43 {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Node.js v18.15.0
ELIFECYCLE Command failed with exit code 1.
rhysd commented
Note: You can import ESM modules in CJS using import()
dynamic import.
rhysd commented
Question: remark
package is ESM only. What is the benefit if remark-emoji
supports CJS? I just got this error when importing remark
with require()
. It seems not working as CommonJS module.
> require('remark')
Uncaught:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/rhysd/Develop/github.com/rhysd/remark-emoji/node_modules/remark/index.js not supported.
Instead change the require of index.js in null to a dynamic import() which is available in all CommonJS modules.
at __node_internal_captureLargerStackTrace (node:internal/errors:490:5)
at new NodeError (node:internal/errors:399:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1282:19)
at Module.load (node:internal/modules/cjs/loader:1113:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1137:19)
at require (node:internal/modules/helpers:121:18) {
code: 'ERR_REQUIRE_ESM'
}