jotai: Using jotai/utils in v1.3.6 on Next.js app (webpack 5) causes errors in build

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './utils' is not defined by "exports" in /Users/tomhicks/Developer/orbital/webapp/node_modules/jotai/package.json

Sorry for the pretty vague report.

Here’s the extent of my investigation:

1.3.3

👍 no build errors 👍

1.3.4 onwards

warn  - ./node_modules/jotai/esm/index.js - Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

then later on

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './utils' is not defined by "exports"

This stops the app from rendering. I reported the first error a while back, and it didn’t seem to prevent the app from rendering, so I’m a bit confused as to why it now won’t render, even on 1.3.4, where before it seemed to render fine despite the warnings.

I don’t think anything else in the build chain has changed (e.g. babel) so I might be misremembering the fact that it rendered on 1.3.4 before.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Cool, no more touching package.json 😂

It’s all good:

nvm use 12.18
npm i https://pkg.csb.dev/pmndrs/jotai/commit/ff0c3415/jotai
npm run dev

✅ 🎉

@tomhicks We want you to rollback to 12.18 and try to use the below package to see if it warns you about unsupported version

yarn add https://pkg.csb.dev/pmndrs/jotai/commit/731da603/jotai
npm i https://pkg.csb.dev/pmndrs/jotai/commit/731da603/jotai

next comment should help you with detailed instructions