-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Vite plugin upset dependencies barrel files #7865
Comments
Also reported on sergiodxa/remix-i18next#161 |
The issue might be partly due to // in react-code-block/dist/index.js
export * from './code-block.js'; // instead of './code-block' Not quite sure yet, but the reason why direct import The effect of it is probably similar to not "externalizing" the dependency (cf. https://vitejs.dev/guide/ssr.html#ssr-externals). import { defineConfig } from "vite";
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [remix(), tsconfigPaths()],
ssr: {
noExternal: ["react-code-block"]
}
}); |
Thanks, that did the trick! Should this be considered solved as a vite problem instead of remix problem? The trick should be added to the migration doc, reminds me a lot of the |
Seeing something similar with a few of my dependencies as well! I tried the suggested fix above but got compilation errors in dev. |
I'm glad that it worked in some cases! |
Looks like @seanmcquaid (or anyone else facing this issue) if you have a reproduction that cannot be fixed via |
How can jQuery be used with the vite compiling? We're migrating a store to use vite but there is a lot of jQuery that we would rather not convert to js |
@bpfullmetal this sounds maybe like a general Vite issue and not Remix-specific, so you might get better guidance asking in the Vite discord or GitHub. Are you able to get jQuery interop working how you expect in Vite w/o Remix? |
What version of Remix are you using?
v2.2.0
Are all your remix dependencies & dev-dependencies using the same version?
Steps to Reproduce
The vite plugin gets upset with certain dependencies' barrel files, complicating migrate path. Thus far, I encountered this issue with
remix-i18next
andreact-code-block
.Expected Behavior
If I avoid the barrel file and import directly, then the library works as expected
Actual Behavior
The errors would be either of:
The text was updated successfully, but these errors were encountered: