How to fix "[module] is not export by [path]" error during build, when it works on development?
Here is the error I get on
yarn build
I had the same error in development and fixed it with:
This is the index.js
it cannot import:
yarn dev
works, but yarn build
fails. It's a local yarn workspace package .5 Replies
Try to add the package within the build.transpile option of your config
i had something like this then i switched to pnpm forever (local and prod)
Problem was that my workspaces was using
commonjs
as the target build π€¦ββοΈ I added a new tsconfig.esm.json
with the correct ESNext
target and now it works even without optimizeDeps
.
@chakraecho I tried to add it to build.transpile
before, but it didn't work.
@π¨π Marko Bolliger <cannap> We will hopefully switch to pnpm soon too π€ Sometimes I am just tired of this obscure node eco system π Hope that pnpm gives us some valuable restrictions.problem with pnpm is i have to put this shamefully-hoist=true
in .npmrc
@π¨π Marko Bolliger <cannap> Ye, I think the ecosystem is unfortunately not ready to be not "shameful" π