Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with the handling of exports maps in package.json #128

Closed
sventschui opened this issue May 11, 2020 · 1 comment
Closed

Issues with the handling of exports maps in package.json #128

sventschui opened this issue May 11, 2020 · 1 comment

Comments

@sventschui
Copy link
Contributor

sventschui commented May 11, 2020

Describe the bug

Vite seems to have troubles to correctly resolve node modules that have exports defined in their package.json. This issue includes a repro for @urql/preact but I found the same issues with @urql/core and wonka. Dropping the exports from the package.jsons helped in all cases.

EDIT: Only applicable to node 13, works with node 12

Reproduction

Add the following import to a basic vite setup:

import { createClient } from '@urql/preact';

(See https://github.com/sventschui/vite-mjs-repro/tree/urql)

System Info

  • required vite version: 0.14.2
  • required Operating System: OS X
  • required Node version: 13.12.0

Logs (Optional if provided reproduction)

  vite:resolve (redirect) @urql/preact -> dist/urql-preact.mjs +4ms
[vite] Error while resolving node_modules with id "@urql/preact/dist/urql-preact.mjs":
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/urql-preact.mjs' is not defined by "exports" in xxx/vite-mjs-repro/node_modules/@urql/preact/package.json
    at applyExports (internal/modules/cjs/loader.js:524:9)
    at resolveExports (internal/modules/cjs/loader.js:541:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:661:22)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:963:27)
    at resolveFileName (xxx/vite-mjs-repro/node_modules/vite/node_modules/resolve-from/index.js:29:39)
    at resolveFrom (xxx/vite-mjs-repro/node_modules/vite/node_modules/resolve-from/index.js:43:9)
    at Object.module.exports [as default] (xxx/vite-mjs-repro/node_modules/vite/node_modules/resolve-from/index.js:46:47)
    at xxx/vite-mjs-repro/node_modules/vite/dist/server/serverPluginModuleResolve.js:79:48
    at async xxx/vite-mjs-repro/node_modules/vite/dist/server/serverPluginModuleRewrite.js:41:9 {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
@yyx990803
Copy link
Member

closed via e49742e

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants