-
Hi there, I have a remix app within a turborepo monorepo, and am I'm importing a local package that has When migrating to Vite, the app appears to build successfully, but fails when I start the app with a After some digging, it appears that I've created a minimal repro here that highlights the error: https://github.com/jam-fran/vite-dirname-example I've tried adding google-gax, @google-cloud/pubsub, and the local monorepo package to Any help would be very much appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I think it might be interesting and helpful if you can show how you're building the app before moving to Vite. For example, were you using CJS at the time (i.e. without Your setup looks a bit tricky to me. Especially Then one peculiar thing I found is that, if I install This is what I was expecting as a default behavior (without adding anything to https://stackblitz.com/edit/github-g5lbb8?file=apps%2Fremix%2Fpackage.json |
Beta Was this translation helpful? Give feedback.
-
Try adding the following to your Vite config: {
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
} |
Beta Was this translation helpful? Give feedback.
I think it might be interesting and helpful if you can show how you're building the app before moving to Vite. For example, were you using CJS at the time (i.e. without
"type": "module"
in your remix app)?Your setup looks a bit tricky to me. Especially
packages/pubsub
is not a traditional npm package since it only provides typescript./src/index.ts
for main app to bundle it together.I wasn't expecting that but it seems Remix/Vite is bundling entire
@google-cloud/pubsub
together withpackages/pubsub
in this scenario.If there is a comparison with previous Remix/Esbuild, then that might give some hint about the issue.
Then one peculiar thing I found is that, if I …