-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Cannot import correctly under TypeScript Node 16 module resolution #992
Comments
Alternatively, |
@mweststrate fyi, per https://arethetypeswrong.github.io/?p=immer%409.0.21 the package settings probably need some tweaks. I've been working on trying to get the Redux packages fixed up to pass, and have been setting up a bunch of CI checks to help verify compatibility. One of them is a CLI script + CI job that runs that I'm about to take a stab at updating Assuming I get these working, might be worth using them as the basis for Immer 10's packaging too. |
Thanks for the pointer! I'll check against the first beta
…On Sun, Apr 2, 2023 at 5:11 PM Mark Erikson ***@***.***> wrote:
@mweststrate <https://github.com/mweststrate> fyi, per
https://arethetypeswrong.github.io/?p=immer%409.0.21 the package settings
probably need some tweaks.
I've been working on trying to get the Redux packages fixed up to pass,
and have been setting up a bunch of CI checks to help verify compatibility.
One of them is a CLI script + CI job that runs that arethetypeswrong tool
and prints out a table similar to the website report:
- reduxjs/redux-toolkit#3294
<reduxjs/redux-toolkit#3294>
I'm about to take a stab at updating redux-thunk, redux, and then
@reduxjs/toolkit with better package configs, probably based on
reduxjs/redux-toolkit#3211
<reduxjs/redux-toolkit#3211> .
Assuming I get these working, might be worth using them as the basis for
Immer 10's packaging too.
—
Reply to this email directly, view it on GitHub
<#992 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBAZ6SKZXNUM422STB3W7GJIJANCNFSM6AAAAAARXXBF7U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yeah, I actually just things seemingly working for all three of those packages? Here's a summary comment in the PR that updated RTK, describing the package settings I settled on: |
I just published ***@***.***` as beta version, would you mind
giving it a quick test drive? If it looks good to you, let me know, I might
have the same ESM/CJS issue as you, and I'm not sure whether it is
concerning or not:
https://arethetypeswrong.github.io/?p=immer%4010.0.0-beta.1
…On Mon, Apr 3, 2023 at 7:31 AM Mark Erikson ***@***.***> wrote:
Yeah, I actually just things seemingly working for all three of those
packages?
Here's a summary comment in the PR that updated RTK, describing the
package settings I settled on:
reduxjs/redux-toolkit#3318 (comment)
<reduxjs/redux-toolkit#3318 (comment)>
—
Reply to this email directly, view it on GitHub
<#992 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBANO2SHHH6GG52RPT3W7JODHANCNFSM6AAAAAARXXBF7U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mweststrate just looking at that report, it looks like a more serious actual "error". What I ended up with is I think, and I haven't gotten confirmation on this, that the "FalseCJS" status is a relatively ignorable warning that shouldn't matter in practice. The You've currently got: "main": "dist/index.js",
"module": "dist/immer.esm.js",
"exports": {
".": {
"types": "./dist/immer.d.ts",
"import": "./dist/immer.esm.js",
"require": "./dist/index.js"
}
}, The
I'm not immediately sure why it's reporting those problems tbh. It seems to have found Oh. It might be because you have I'll go ahead and try bumping RTK's Immer dep to the beta now and see how it works, but based on what I think I'm seeing here, my thoughts are:
|
Yeah, sure enough, one of the Node example projects I set up for RTK's CI pipeline fails with this Immer beta:
|
Does beta.3 fare any better? I only dropped the type definition. https://arethetypeswrong.github.io/?p=immer%4010.0.0-beta.3 still reports a problem, but I don't get why since the main is CJS, and module is ESM, so that looks pretty correct to me intuitively? |
This looks better: https://arethetypeswrong.github.io/?p=immer%4010.0.0-beta.4. Don't look at the sources, yikes. Hopefully doesn't break sourcemaps |
Yeah! Now it's "just" got the same "FalseCJS" issue that I'm seeing over on the RTK side :) FYI Andrew Branch and I were just discussing that particular problem over in this thread: arethetypeswrong/arethetypeswrong.github.io#21 His latest comment was:
but there's no easy way to do this atm. |
Also FYI: I see that as of For For RTK, where we use a bunch of optional chaining, I'm generating a fallback build artifact that has a I'm about ready to push out another RTK alpha that includes Immer 10 beta. You have time now-ish to try adjusting that |
Huh. Somewhat surprisingly, beta.4 seems to have built okay with our I'm gonna go ahead and push out an RTK alpha that uses beta.4 since this seems to be working-ish for now! |
this is fixed in immer v10 |
🐛 Bug Report
Under TypeScript Node 16 module resolution (has
type: module
in thepackage.json
andmoduleResolution: Node16
intsconfig.json
), this package cannot be imported correctly.TypeScript thinks this package is a CommonJS package and therefore provides the synthetic export for the CommonJS module.
To Reproduce
Observed behavior
Cannot be imported.
Expected behavior
Imported correctly.
Environment
The text was updated successfully, but these errors were encountered: