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

v2.1.0 causes "Cannot find module" error #134

Open
wub opened this issue Apr 3, 2023 · 3 comments
Open

v2.1.0 causes "Cannot find module" error #134

wub opened this issue Apr 3, 2023 · 3 comments

Comments

@wub
Copy link

wub commented Apr 3, 2023

After updating from 2.0.4 to 2.1.0, I now get this error (using this with Remix - so the code is running on both server and client).

[server] Error: Cannot find module '/Users/x/x/client/node_modules/chakra-ui-steps/dist/chakra-ui-steps.umd.cjs'
[server]     at createEsmNotFoundErr (node:internal/modules/cjs/loader:1112:15)
[server]     at finalizeEsmResolution (node:internal/modules/cjs/loader:1105:15)
[server]     at resolveExports (node:internal/modules/cjs/loader:579:14)
[server]     at Function.Module._findPath (node:internal/modules/cjs/loader:648:31)
[server]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1076:27)
[server]     at Function.Module._load (node:internal/modules/cjs/loader:934:27)
[server]     at Module.require (node:internal/modules/cjs/loader:1157:19)
[server]     at require (node:internal/modules/helpers:119:18)
[server]     at Object.<anonymous> (/Users/x/x/client/app/root.tsx:5:37)
[server]     at Module._compile (node:internal/modules/cjs/loader:1275:14)
[server] yarn run dev:server exited with code 1
[remix] The path "chakra-ui-steps" is imported in app/root.tsx but "chakra-ui-steps" was not found in your node_modules. Did you forget to install it?

I imagine it might have something to do with this change?

2.0.4:

  "main": "./dist/chakra-ui-steps.umd.js",
  "module": "./dist/chakra-ui-steps.es.js",
  "exports": {
    ".": {
      "import": "./dist/chakra-ui-steps.es.js",
      "require": "./dist/chakra-ui-steps.umd.js"
    }
  },

2.1.0:

  "main": "./dist/chakra-ui-steps.umd.cjs",
  "module": "./dist/chakra-ui-steps.mjs",
  "exports": {
    ".": {
      "import": "./dist/chakra-ui-steps.mjs",
      "require": "./dist/chakra-ui-steps.umd.cjs"
    }
  },
@arslansajid
Copy link

I was using the version 2.0.4 and after upgrading to 2.1.0 facing the same problem.

@lukaszszmolke
Copy link

lukaszszmolke commented Sep 19, 2023

I have the same issue. Since it was not solved since April i decided fork library.
Package ESM entrypoint needs to be upgraded.

I changed in package.json from:

"exports": {
    ".": {
      "import": "./dist/chakra-ui-steps.mjs",
      "require": "./dist/chakra-ui-steps.umd.cjs"
    }
  }

to:

"exports": {
    ".": {
      "import": {
        "default": "./dist/chakra-ui-steps.mjs",
        "types": "./dist/index.d.ts"
      },
      "require": "./dist/chakra-ui-steps.umd.js"
    }
  }

Currently works as expected :)

Explanation here: https://stackoverflow.com/questions/72457791/typescript-packages-that-ship-with-mjs-and-d-ts-but-without-d-mts-how-to-i

@alisamar
Copy link

After upgrading to 2.1.0, I have the same problem with the Jest test.

#134 (comment) this worked for me too.

FAIL src/component/index.spec.tsx
● Test suite failed to run

Cannot find module 'chakra-ui-steps' from 'src/theme/index.ts'

Require stack:
  src/theme/index.ts
  test/index.tsx
  src/component/index.spec.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants