Skip to content

How to use electron-vite with Linaria? #633

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

You must be logged in to vote

Here is the solution:

Note: the contents of the

  1. Install the following dependencies:
bun add --dev @linaria/core @linaria/react @wyw-in-js/vite @vitejs/plugin-react vite-tsconfig-paths
  1. Add the wyw plugin to your electron.vite.config.ts file as follows:
import wyw from "@wyw-in-js/vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { defineConfig, bytecodePlugin, externalizeDepsPlugin, swcPlugin } from "electron-vite";
import type { Plugin } from "vite";

function getNodePlugins(env: ConfigEnv): (Plugin | null)[] {
   if (env.mode === "production") {
      return [swcPlugin(), externalizeDepsPlugin(), bytecodePlugin()];
   }
   return [

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aabmets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant