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

Add vite resolve parameter to createViteServer #1304

Merged
merged 9 commits into from
Feb 1, 2024

Conversation

fukumasuya
Copy link
Contributor

@fukumasuya fukumasuya commented Feb 1, 2024

Fixes #1303.

It looks a vite resolve parameter not passed to a vite server created by createViteServer. so the server does not resolve aliased paths in css.ts files. I added viteResolve argument.

Failed to load url @util/style (resolved id: @util/style) in /workspaces/sandbox/src/component/CountButton.css.ts. Does the file exist?

css.ts

import { styleSquare } from "@util/style"; // aliased path
import { style } from "@vanilla-extract/css";

export const styleBase = style([
  styleSquare,
  {
    color: "red",
  },
]);

vite.config.ts

export default defineConfig({
  resolve: {
    alias: {
      "@util": path.resolve(__dirname, "./src/util"),
    },
  },
  plugins: [react(), vanillaExtractPlugin()],
});

Copy link

changeset-bot bot commented Feb 1, 2024

🦋 Changeset detected

Latest commit: 047ec66

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@vanilla-extract/integration Minor
@vanilla-extract/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mrm007
Copy link
Contributor

mrm007 commented Feb 1, 2024

Thanks @fukumasuya! I'll add a few tests to cover the new functionality.

@mrm007 mrm007 merged commit 545bf82 into vanilla-extract-css:master Feb 1, 2024
5 checks passed
@fukumasuya fukumasuya deleted the fix-alias-paths-issue branch February 2, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vite-plugin v4 does not resolve aliased paths in css.ts files
3 participants