-
Notifications
You must be signed in to change notification settings - Fork 46
Webpack 5 support is broken #23
Comments
@transitive-bullshit we can probably do without swr, don't you think? No need to revalidate here! I'm working on the project today btw, so I could test it on a branch, and see how it goes. |
Agreed; |
I think I got it working with It seems that whenever we try to get fancy with package.json
the result is that the cjs version doesn't work because webpack views it as "type": "module" and interprets it as ESM. For now, just removing the |
You can place a package.json here: Otherwise |
Thanks @sokra, I'm gonna try to implement it. Just for clarification, what I need to do is:
Is that correct? It is a bit weird for me to put a file in the build dir. Won't it get deleted/overridden by webpack on build? |
@DaniGuardiola we would need to do something like: {
"postbuild": "echo '{ \"type\": \"commonjs\" }' > build/cjs/package.json"
} which would create this package file every time. This isn't really elegant, however.. it's unfortunate that Typescript doesn't support this as output microsoft/TypeScript#18442. Currently, just removing {
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"typings": "build/esm/index.d.ts"
} without adding the new @sokra really appreciate you chiming in 💪 and congrats on the new job at Vercel! I've run into this exact same issue with 3-4 different TypeScript-powered packages that I own where my end result has been to degrade to the old, non-exports syntax which seems to "just work" by being less explicit. I'm curious how package authors like us who want to support TypeScript => ESM + CJS should be doing things going forwards since imho the Thanks! |
Fixed in |
0.6.0 of what ? |
See vercel/swr#1112 and #20
The text was updated successfully, but these errors were encountered: