Open chinanderm opened 1 year ago
@chinanderm Is this still an issue with the new vite remix plugin and v4 of the VE vite plugin? We've made sure it works correctly with tsconfig paths.
@chinanderm Is this still an issue with the new vite remix plugin and v4 of the VE vite plugin? We've made sure it works correctly with tsconfig paths.
@askoufis I'm assuming it won't be once we're able to transition our Remix apps to the Vite integration. We haven't been able to do that yet as we're waiting on support for Remix+Vite within Shopify Hydrogen. That's coming soon though so I imagine we'll have a resolution on this within the next few weeks.
@askoufis I'm assuming it won't be once we're able to transition our Remix apps to the Vite integration. We haven't been able to do that yet as we're waiting on support for Remix+Vite within Shopify Hydrogen. That's coming soon though so I imagine we'll have a resolution on this within the next few weeks.
Great! Thanks for the update.
Describe the bug
In an Nx monorepo we are using vanilla-extract to style components that are imported by a handful of Remix applications. When a Remix application has
*.css.ts
files directly, or imports one via a shared lib/package in the monorepo with a relative import, no issues exist. However, if the import is via a path alias (via tsconfig), Vite in the vanilla-extractintegration
package process cannot resolve the path of the import.After some debugging and an investigation, we think we've found the problem at the call to
vite.createServer()
in packages/integration/src/compiler.ts. Here, there is no ability to pass in aresolve.alias
Vite configuration to define aliases.In the mean time, we've created a patch in our repo that adds in
resolve.alias
to the config object passed tovite.createServer()
. This patch solves the problem for us in the short term but ideally Remix and/or the integration code in vanilla-extract can support an alias configuration, whether automatic or manual.We've created a reproduction repo that can highlight the issue. A couple notes:
npm run example-app:dev
patches.off
topatches
.@markdalgleish I know you're also on the Remix team so hopefully this can be a joint effort to resolve!
Reproduction
https://github.com/chinanderm/remix-vanilla-extract-vite-alias
System Info
Used Package Manager
npm
Logs
Validations