Skip to content

How to use libraries built with Vanilla Extract in development mode with Vite (optimizeDeps issue) #1051

Closed Answered by bestickley
bestickley asked this question in Q&A
Discussion options

You must be logged in to vote

Solved!
The key here is the line: plugins: [veEsbuildPlugin({ runtime: true })], in the below vite.config.ts:

import { defineConfig, loadEnv } from "vite";
import { createHtmlPlugin } from "vite-plugin-html";
import { vanillaExtractPlugin as veVitePlugin } from "@vanilla-extract/vite-plugin";
import { vanillaExtractPlugin as veEsbuildPlugin } from "@vanilla-extract/esbuild-plugin";
import tsconfigPaths from "vite-tsconfig-paths";
import _react from "@vitejs/plugin-react";
// https://github.com/vitejs/vite/issues/10481
const react = _react as unknown as typeof _react.default;

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd())

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@chris-ldgk
Comment options

Answer selected by bestickley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants