Skip to content
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

Cannot provide path aliases to vanilla-extract plugin integration #7077

Open
1 task done
chinanderm opened this issue Aug 5, 2023 · 4 comments
Open
1 task done
Assignees
Labels

Comments

@chinanderm
Copy link

What version of Remix are you using?

1.19.1

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

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, everything works great. However, if the import is via a path alias (defined in tsconfig), Vite in the vanilla-extract plugin/integration process cannot resolve the path of the import. Furthermore, there is no ability to tell Remix about path aliases so it can pass those on to the vanilla-extract integration.

We've created a reproduction repo that can highlight the situation.

After some debugging and an investigation, we've found where in vanilla-extract these aliases would need to be introduced: the call to vite.createServer() in packages/integration/src/compiler.ts. Here, there is no ability to pass in a resolve.alias Vite configuration to define aliases. On the Remix side, there's no ability to define these aliases to pass through to vanilla-extract.

In the mean time, we've created a patch in our repo that adds in resolve.alias to the config object passed to vite.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.

Seeing as this would likely need to be an update in both Remix and vanilla-extract, an issue has also been opened in that repo.

Expected Behavior

The expected behavior is that path aliases can be resolved when processing *.css.ts files.

Actual Behavior

Code imported in *.css.ts files via path aliases cannot be resolved, leading to build errors.

@MichaelDeBoey

This comment was marked as off-topic.

@chinanderm

This comment was marked as off-topic.

@MichaelDeBoey

This comment was marked as off-topic.

@chinanderm

This comment was marked as off-topic.

@markdalgleish markdalgleish added bug Something isn't working and removed bug:unverified labels Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants