Named export not found on production build #872
-
DescriptionHello, In one of my projects, I'm getting the following error on production builds:
Changing the import to the suggested format doesn't seem to work. However, importing using an explicit path does seem to work: import { ApolloClient } from "@apollo/client/core/ApolloClient" However, this is more of a workaround and less of a actual fix. On development, all of this works fine. A mimimum reproducible repository is available at https://github.com/mvdstam/vite-ssr-test. Simply clone the repository, run Either I'm doing something wrong, or this is a bug. Either way, I hope you can point me in the right direction. 😃 Possibly related to #634 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Have you seen https://vite-plugin-ssr.com/common-issues#npm-packages-containing-invalid-code? |
Beta Was this translation helpful? Give feedback.
-
Hi @brillout, thanks so much for your quick reply. The NPM package const config: UserConfig = {
plugins: [react(), ssr()],
ssr: {
noExternal: ['@apollo/client']
}
} It's also good to hear that the error was on my end instead of a bug. Please consider the issue closed. Thanks again for your help! |
Beta Was this translation helpful? Give feedback.
-
Improved reproduction: https://github.com/brillout/cjs-esm-bug_apollo. |
Beta Was this translation helpful? Give feedback.
Have you seen https://vite-plugin-ssr.com/common-issues#npm-packages-containing-invalid-code?