Dual package import issue in electron-forge/webpack env and potential fix #1537
Replies: 1 comment
-
Thanks for the investigation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Importing
jotai/utils
leads to a different import path compared to importing onlyjotai
. This creates a duplicate instance of the library and state is not shared between the two, leading to issues ilke this one. Somehow thejotai
import insidenode_modules
resolves toesm/index.mjs
whereas the import from the project resolves toesm/index.js
.Electron has no support for ES modules currently, but webpack handles the resolution and conversion to commonjs, so it's fine to import ESM from node_modules. Specifying
resolve.conditionNames
inwebpack.renderer.config.js
seems to have fixed the issue for me:conditionNames
is an ordered list of import strategies from packages and now everything resolves tojotai/*.mjs
.I'm not sure what the difference between
import
andmodule
is, but I added both in any case to avoid issues with other installed packages.I haven't done further tests but the linked issue no longer occurs.
Thanks to @dai-shi for pointing me in the right direction.
Beta Was this translation helpful? Give feedback.
All reactions