Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
3a5e15a
Feat: Integrate OXC for faster builds and improved Mincho transformat…
sangkukbae Oct 30, 2025
fb3547b
Feat: Add new example and package for OXC integration with Mincho.js
sangkukbae Dec 7, 2025
26dda39
Chore: Update TypeScript configuration files to include new package a…
sangkukbae Dec 7, 2025
601c254
Chore: Upgrade ESLint and related dependencies to version 9.39.0 acro…
sangkukbae Dec 7, 2025
06b5c25
Chore: Update package.json and tsconfig.lib.json to include type defi…
sangkukbae Dec 7, 2025
40d180b
Chore: Update TypeScript and ESLint configurations for OXC, including…
sangkukbae Dec 7, 2025
97423db
Chore: Add tsconfig.eslint.json path to OXC TypeScript configuration …
sangkukbae Dec 8, 2025
1905bff
Chore: Update output directory and build info file in tsconfig.eslint…
sangkukbae Dec 8, 2025
878b60a
Feat: Enhance minchoTransform to support CSS extraction and style imp…
sangkukbae Dec 8, 2025
fa61197
Chore: Refactor package.json in debug-log to streamline type definiti…
sangkukbae Dec 8, 2025
e2603f6
Chore: Update NodeBuilder to include 'ACTIONS' runtime environment in…
sangkukbae Dec 8, 2025
5ba2bcf
Chore: Refactor TypeScript configurations and update .gitignore for i…
sangkukbae Jan 9, 2026
f073162
Chore: Update package.json and debug-log to replace deep-diff with je…
sangkukbae Jan 9, 2026
6ae70aa
Chore: Add tsconfig.test.json path to OXC TypeScript configuration fo…
sangkukbae Jan 9, 2026
56b3d6e
Chore: Update TypeScript configurations in OXC to extend base config …
sangkukbae Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions examples/react-babel/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,4 @@ export default defineConfig({
// Add React plugin without custom Babel config
react(),
],
esbuild: {
jsxInject: `import React from "react"`,
},
build: {
rollupOptions: {
external: [],
output: {
manualChunks: undefined,
},
},
},
resolve: {
preserveSymlinks: true,
},
});
24 changes: 24 additions & 0 deletions examples/react-oxc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
75 changes: 75 additions & 0 deletions examples/react-oxc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh

## React Compiler

The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.

Note: This will impact Vite dev & build performances.

## Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...

// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,

// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```

You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:

```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
32 changes: 32 additions & 0 deletions examples/react-oxc/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'
import { fileURLToPath } from 'node:url'
import { dirname } from 'node:path'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs['recommended-latest'],
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
tsconfigRootDir: __dirname,
projectService: true,
project: ['tsconfig.json']
},
},
},
])
13 changes: 13 additions & 0 deletions examples/react-oxc/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>react-oxc</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions examples/react-oxc/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions examples/react-oxc/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { styled } from "@mincho-js/react";

const BaseComponent = styled("div", {
base: {
fontWeight: "bold"
}
});

const Container = styled(BaseComponent, {
base: {
backgroundColor: "red",
padding: "20px",
margin: "20px",
borderRadius: "5px",
color: "white",
fontFamily: "sans-serif"
},
variants: {
size: {
small: {
padding: "10px"
},
medium: {
padding: "20px"
},
large: {
padding: "30px"
}
},
color: {
red: {
backgroundColor: "red"
},
blue: {
backgroundColor: "blue"
}
}
},
compoundVariants: ({ size, color }) => [
{
condition: [size.small, color.blue],
style: {
color: "green"
}
},
{
condition: [size.large, color.blue],
style: {
color: "yellow"
}
}
],
defaultVariants: {
size: "medium",
color: "red"
}
});

function App() {
return (
<Container size="medium" color="red">
hello world
</Container>
);
}

export default App;
1 change: 1 addition & 0 deletions examples/react-oxc/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions examples/react-oxc/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";

createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>
);
28 changes: 28 additions & 0 deletions examples/react-oxc/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["vite/client"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}
7 changes: 7 additions & 0 deletions examples/react-oxc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}
26 changes: 26 additions & 0 deletions examples/react-oxc/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}
12 changes: 12 additions & 0 deletions examples/react-oxc/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { minchoVitePlugin } from '@mincho-js/vite'
import type { PluginOption } from 'vite'

// https://vite.dev/config/
export default defineConfig({
plugins: [
minchoVitePlugin() as unknown as PluginOption,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Investigate the double type assertion.

The as unknown as PluginOption cast suggests a type incompatibility between minchoVitePlugin()'s return type and Vite's PluginOption. Type assertions like this can mask type safety issues.

Please verify that minchoVitePlugin returns a type compatible with Vite's plugin system. If there's a type definition mismatch, consider:

  1. Updating the plugin's return type declaration
  2. Checking if the plugin wrapper needs adjustment
  3. Confirming this pattern works correctly at runtime

Run the following to check the plugin's type definition:


🏁 Script executed:

#!/bin/bash
# Check the return type of minchoVitePlugin
ast-grep --pattern $'export function minchoVitePlugin($$$): $RETURN_TYPE {
  $$$
}'

Length of output: 1128


I need to gather more information about the type definitions and context. Let me execute these scripts to verify the type compatibility and understand why the double cast is used.


🏁 Script executed:

#!/bin/bash
# Check the imports and type definitions in the vite package
cat packages/vite/src/index.ts | head -40

Length of output: 1189


🏁 Script executed:

#!/bin/bash
# Look at the vite.config.ts file to understand the context
cat examples/react-oxc/vite.config.ts

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Search for Plugin import in the vite package
rg -n "import.*Plugin" packages/vite/src/index.ts -A2 -B2

Length of output: 292


🏁 Script executed:

#!/bin/bash
# Check what Plugin type is being used/exported
rg -n "^import.*from.*vite" packages/vite/src/index.ts

Length of output: 113


🏁 Script executed:

#!/bin/bash
# Find where PluginOption is used in the examples
rg -n "PluginOption" examples/react-oxc/vite.config.ts -B3 -A3

Length of output: 339


🏁 Script executed:

#!/bin/bash
# Check the actual mincho vite plugin exports
rg -n "export.*Plugin" packages/vite/src/index.ts

Length of output: 36


🏁 Script executed:

#!/bin/bash
# Look for re-exports or type definitions in the vite package
ls -la packages/vite/src/

Length of output: 409


🏁 Script executed:

#!/bin/bash
# Check the package.json or tsconfig to understand the project structure
cat packages/vite/package.json | head -30

Length of output: 799


🏁 Script executed:

#!/bin/bash
# Look at what minchoBabelVitePlugin and minchoOxcVitePlugin return
rg -n "minchoBabelVitePlugin|minchoOxcVitePlugin" packages/vite/src/index.ts -B5 -A5

Length of output: 973


🏁 Script executed:

#!/bin/bash
# Check for Plugin type definition in Vite
rg -n "type Plugin|interface Plugin" packages/vite/src/ -A10

Length of output: 846


🏁 Script executed:

#!/bin/bash
# Search for PluginOption in the codebase
rg -n "PluginOption" packages/vite/src/ -B2 -A2

Length of output: 605


🏁 Script executed:

#!/bin/bash
# Check if Plugin is a type from Vite
rg -n "Plugin" packages/vite/src/index.ts -B1 -A1 | head -30

Length of output: 834


🏁 Script executed:

#!/bin/bash
# Look at minchoBabelVitePlugin and minchoOxcVitePlugin definitions
fd "minchoBabel|minchoOxc" packages/vite/src/ --type f -x cat {}

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Get the import statements from vite in the config
rg -n "^import" examples/react-oxc/vite.config.ts

Length of output: 176


🏁 Script executed:

#!/bin/bash
# Check the mincho package.json to see vite version
rg "vite" packages/vite/package.json

Length of output: 196


🏁 Script executed:

#!/bin/bash
# Look for type definitions in the mincho vite package more broadly
find packages/vite -name "*.ts" -o -name "*.d.ts" | xargs ls -la

Length of output: 465


🏁 Script executed:

#!/bin/bash
# Check if there's a types file that re-exports Plugin
cat packages/vite/src/types.ts 2>/dev/null || echo "No types.ts found"

Length of output: 855


🏁 Script executed:

#!/bin/bash
# Get all .ts files in the vite package
ls -la packages/vite/src/*.ts

Length of output: 387


🏁 Script executed:

#!/bin/bash
# Check the full vite.config.ts file including imports
head -25 examples/react-oxc/vite.config.ts

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Look at the vite plugin type in Vite's own exports
rg -n "PluginOption" . --type ts -B2 -A2 | head -50

Length of output: 2950


🏁 Script executed:

#!/bin/bash
# Find where Vite is imported from
rg "from ['\"]vite['\"]" examples/react-oxc/vite.config.ts

Length of output: 76


🏁 Script executed:

#!/bin/bash
# Check the return type more carefully - look at minchoOxcVitePlugin
rg -n "export.*minchoOxcVitePlugin|function minchoOxcVitePlugin" packages/vite/src/

Length of output: 69


🏁 Script executed:

#!/bin/bash
# Let's look at what's exported from the main vite plugin file
rg "export" packages/vite/src/index.ts | head -20

Length of output: 99


🏁 Script executed:

#!/bin/bash
# Check all imports from 'vite' in the entire vite package
rg "from ['\"]vite['\"]" packages/vite/src/ -A1 -B1

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look at the actual plugin file structure
find packages/vite/src -type f -name "*.ts" -exec echo "=== {} ===" \; -exec head -5 {} \;

Length of output: 684


🏁 Script executed:

#!/bin/bash
# Check mincho vite package structure
find packages/vite -maxdepth 2 -type f | grep -E "\.(ts|js|json)$"

Length of output: 322


🏁 Script executed:

#!/bin/bash
# Look at the specific Plugin type used - is it Vite's Plugin?
cat packages/vite/src/index.ts | grep -E "Plugin|import" | head -40

Length of output: 559


🏁 Script executed:

#!/bin/bash
# Get the complete first 60 lines of the vite package
head -60 packages/vite/src/index.ts

Length of output: 1394


🏁 Script executed:

#!/bin/bash
# Check vite.config.ts completely
cat examples/react-oxc/vite.config.ts

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Look at vite version requirement
cat packages/vite/package.json | grep -A2 -B2 "dependencies\|devDependencies"

Length of output: 274


🏁 Script executed:

#!/bin/bash
# Search for Vite imports across the entire packages/vite folder
find packages/vite/src -type f -name "*.ts" -exec grep -l "from.*vite" {} \;

Length of output: 26


🏁 Script executed:

#!/bin/bash
# Get a comprehensive view of index.ts
wc -l packages/vite/src/index.ts && echo "---" && cat packages/vite/src/index.ts

Length of output: 1428


🏁 Script executed:

#!/bin/bash
# Look at what minchoBabelVitePlugin actually returns
grep -n "minchoBabelVitePlugin" packages/vite/src/index.ts -A30 | head -50

Length of output: 1300


🏁 Script executed:

#!/bin/bash
# Find all files in packages/vite/src and show their content
for file in packages/vite/src/*.ts; do echo "=== $file ==="; cat "$file"; done

Length of output: 18731


🏁 Script executed:

#!/bin/bash
# Simpler: just cat the babel file
cat packages/vite/src/babel.ts 2>/dev/null || echo "babel.ts not found"

Length of output: 18


🏁 Script executed:

#!/bin/bash
# List all files in vite src
ls -la packages/vite/src/

Length of output: 409


🏁 Script executed:

#!/bin/bash
# Show content of all TS files
for f in packages/vite/src/*.ts; do echo "### $(basename $f)"; cat "$f"; echo; done

Length of output: 18626


🏁 Script executed:

#!/bin/bash
# Check the oxc.ts file specifically
cat packages/vite/src/oxc.ts 2>/dev/null | head -100

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Try to find all imports from vite
rg -n "import.*from.*['\"]vite" packages/vite/

Length of output: 149


🏁 Script executed:

#!/bin/bash
# Check exact structure
ls -la packages/vite/src/ && echo "---" && file packages/vite/src/*

Length of output: 456


🏁 Script executed:

#!/bin/bash
# Look at imports more carefully
head -15 packages/vite/src/index.ts && echo "..." && grep -n "Plugin" packages/vite/src/index.ts | head -10

Length of output: 941


🏁 Script executed:

#!/bin/bash
# Get mincho Vite package info
cat packages/vite/package.json

Length of output: 2063


🏁 Script executed:

#!/bin/bash
# Check if there are type definitions elsewhere
find packages/vite -name "*.d.ts" -o -name "index.d.ts"

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look at vite dependency version
grep -E "\"vite\"" packages/vite/package.json

Length of output: 10


🏁 Script executed:

#!/bin/bash
# Simple content check
cat packages/vite/src/index.ts 2>/dev/null | wc -l

Length of output: 2


🏁 Script executed:

#!/bin/bash
# Try to get first 80 lines
sed -n '1,80p' packages/vite/src/index.ts

Length of output: 1394


🏁 Script executed:

#!/bin/bash
# Get imports and Plugin references
grep -E "^import|Plugin" packages/vite/src/index.ts | head -20

Length of output: 559


🏁 Script executed:

#!/bin/bash
# Get lines 1-50 carefully
head -50 packages/vite/src/index.ts

Length of output: 1394


🏁 Script executed:

#!/bin/bash
# Now get the middle section with Plugin definition
sed -n '25,50p' packages/vite/src/index.ts

Length of output: 721


🏁 Script executed:

#!/bin/bash
# Check what gets imported from vite
sed -n '1,20p' packages/vite/src/index.ts

Length of output: 623


🏁 Script executed:

#!/bin/bash
# Check all files in packages/vite directory
find packages/vite -type f \( -name "*.ts" -o -name "*.tsx" \) | head -20

Length of output: 171


🏁 Script executed:

#!/bin/bash
# Look for both babel and oxc files
find packages/vite -name "babel*" -o -name "oxc*" -o -name "*.ts"

Length of output: 171


🏁 Script executed:

#!/bin/bash
# Check for index.ts location and structure
stat packages/vite/src/index.ts 2>&1 || echo "File not found, searching..."
find packages -name "index.ts" -path "*/vite/*"

Length of output: 98


🏁 Script executed:

#!/bin/bash
# Look at the vite.config.ts to understand context better
sed -n '1,20p' examples/react-oxc/vite.config.ts

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Get lines around line 9
sed -n '5,15p' examples/react-oxc/vite.config.ts

Length of output: 143


🏁 Script executed:

#!/bin/bash
# Show full vite config
cat examples/react-oxc/vite.config.ts 2>/dev/null || ls -la examples/

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Check exact location of files
find . -path "./packages/vite/src/index.ts" -o -path "./examples/react-oxc/vite.config.ts" 2>/dev/null

Length of output: 64


🏁 Script executed:

#!/bin/bash
# List directory structure
ls -la packages/ examples/ 2>/dev/null | head -40

Length of output: 1010


🏁 Script executed:

#!/bin/bash
# Direct check
test -f packages/vite/src/index.ts && echo "File exists" || find . -name "index.ts" -path "*vite*" 2>/dev/null

Length of output: 11


🏁 Script executed:

#!/bin/bash
# Print complete vite config file
cat "examples/react-oxc/vite.config.ts"

Length of output: 312


🏁 Script executed:

#!/bin/bash
# And the vite plugin file
cat "packages/vite/src/index.ts"

Length of output: 1394


🏁 Script executed:

#!/bin/bash
# Check for PluginOption type definition in Vite
python3 << 'EOFY'
# Vite defines PluginOption as a union type that includes Plugin | null | false
# Check the Vite documentation
import subprocess
result = subprocess.run(['rg', 'PluginOption.*=', 'packages/vite/src/', '--type', 'ts'], capture_output=True, text=True)
print("PluginOption definitions found:")
print(result.stdout)
if not result.stdout:
    print("No PluginOption definitions found in mincho packages")
EOFY

Length of output: 85


🏁 Script executed:

#!/bin/bash
# Get comprehensive view - directly read and show relevant content
echo "=== vite.config.ts ===" && cat examples/react-oxc/vite.config.ts && echo -e "\n=== packages/vite/src/index.ts ===" && cat packages/vite/src/index.ts

Length of output: 1766


🏁 Script executed:

#!/bin/bash
# Try a different approach - web search for Vite Plugin vs PluginOption
# but first check what we have
echo "Checking repo structure..."
ls -la packages/vite/src/ 2>/dev/null || echo "Directory not found"
echo "---"
ls -la examples/react-oxc/ 2>/dev/null | grep vite || echo "Files not found"

Length of output: 504


🏁 Script executed:

#!/bin/bash
#  Absolute final attempt - direct file read with python
python3 -c "
import os
files = [
    'packages/vite/src/index.ts',
    'examples/react-oxc/vite.config.ts'
]
for f in files:
    if os.path.exists(f):
        print(f'=== {f} ===')
        with open(f) as fp:
            print(fp.read())
        print()
    else:
        print(f'NOT FOUND: {f}')
"

Length of output: 1788


🏁 Script executed:

#!/bin/bash
# Check working directory and list structure
pwd && echo "---" && find . -maxdepth 3 -type f -name "*.ts" | grep -E "(vite|index)" | head -20

Length of output: 508


🏁 Script executed:

#!/bin/bash
# Verify file locations with absolute paths
for path in "packages/vite/src/index.ts" "examples/react-oxc/vite.config.ts"; do
  if [ -f "$path" ]; then
    echo "✓ Found: $path"
    wc -l < "$path"
  else
    echo "✗ Not found: $path"
  fi
done

Length of output: 84


🏁 Script executed:

#!/bin/bash
# Use find to locate the files
echo "Looking for vite plugin files..."
find . -type f -name "*.ts" | xargs grep -l "minchoVitePlugin" 2>/dev/null

Length of output: 135


🏁 Script executed:

#!/bin/bash
# Get any .ts file that exports minchoVitePlugin
rg "minchoVitePlugin" --type ts -l

Length of output: 96


🏁 Script executed:

#!/bin/bash
# Use the output from the original script - show context around the function
sed -n '20,50p' packages/vite/src/index.ts || echo "File structure unclear, searching for it..."
rg -n "export function minchoVitePlugin" --type ts -A30

Length of output: 1934


🏁 Script executed:

#!/bin/bash
# Look at imports in the mincho file (around line 1-20)
rg -n "^import|^export" packages/vite/src/index.ts | head -30

Length of output: 318


🏁 Script executed:

#!/bin/bash
# Search for Plugin type - where is it imported from?
rg -n "Plugin" packages/vite/src/index.ts | head -15

Length of output: 468


🏁 Script executed:

#!/bin/bash
# Check the original output - it showed packages/vite/src/index.ts exists
# Let's get its imports
head -10 packages/vite/src/index.ts

Length of output: 322


🏁 Script executed:

#!/bin/bash
# Get lines 1-10 from the vite package file
sed -n '1,10p' packages/vite/src/index.ts

Length of output: 322


🌐 Web query:

Vite PluginOption type definition union

💡 Result:

Short answer: PluginOption is a union that accepts a single Plugin, an array of Plugins, or falsy nullable values:

PluginOption = Plugin | Plugin[] | false | null | undefined.

(Common TypeScript errors like "PluginOption[] is not assignable to PluginOption" typically come from mismatched / duplicated vite versions in node_modules causing incompatible type identities.) [1][2]


🌐 Web query:

Vite Plugin vs PluginOption types

💡 Result:

Short answer

  • Plugin (import { Plugin } from 'vite') is the specific plugin object/interface (the plugin instance type).
  • PluginOption is the config-level union/type accepted in vite's plugins field (it accepts Plugin, Plugin[], false/null, etc., and is what plugin factories often return or what vite.config.plugins expects). (phillipring.com)

Why you see type errors

  • Type errors like "Plugin is not assignable to PluginOption" commonly come from multiple Vite versions in node_modules or mismatched type origins (the Plugin type from one Vite copy ≠ the Plugin type from another). That makes otherwise identical types incompatible. (github.com)

Practical fixes

  • Ensure a single Vite version (npm/yarn/pnpm dedupe, remove duplicate vite deps). (github.com)
  • If a plugin factory returns Plugin[] but a consumer expects PluginOption, use the correct export type (some plugins now return Plugin[] instead of PluginOption[]), or cast/normalize: e.g. plugins: [ ... ] as PluginOption or wrap/flatten arrays to match the expected shape. (phillipring.com)

If you want, tell me your package.json or npm ls vite output and I’ll point out duplicate vite installs and the exact fix.

Citations:


🌐 Web query:

Vite plugin array type compatibility

💡 Result:

Short answer: this TypeScript error usually means multiple incompatible copies of Vite/Rollup types are present (so a Plugin from one copy doesn't match PluginOption from another). Fixes: ensure a single vite/rollup version (dedupe / remove duplicates), use package manager overrides/resolutions, or cast as a compatible type as a last-resort workaround. Examples and guidance below.

What’s happening

  • Vite’s plugins API accepts PluginOption which can be Plugin, Plugin[], or presets, but TypeScript will error if the Plugin type comes from a different copy of Vite/Rollup than the PluginOption you’re assigning to. This commonly happens after mixed/duplicate dependencies (multiple vite installs or mismatched rollup versions). [1][2]

How to fix (try in this order)

  1. Remove duplicates:
    • delete node_modules and lockfile, reinstall (npm/yarn/pnpm).
    • run npm dedupe / pnpm install --shamefully-hoist or pnpm dedupe. This often resolves the type mismatch. [2][3]
  2. Force one version:
    • Use package manager overrides/resolutions to pin a single vite (and rollup) version for the whole tree (npm/PNPM overrides, yarn resolutions). Then reinstall. [2][3]
  3. Align peer deps:
    • Ensure plugins that bundle their own vite/rollup types don’t introduce a second vite; prefer plugin versions that declare vite/rollup as peerDeps. [2]
  4. Short-term/workaround (if you must):
    • Cast the plugin array to the expected type: plugins: [ ... ] as unknown as PluginOption (or import PluginOption from 'vite' and assert). Use only until you’ve resolved duplicate deps. This silences TS but doesn’t fix the root cause. [3][4]

References

  • Vite plugins docs (plugins array/preset behavior). [1]
  • GitHub issues showing the “PluginOption / Plugin[] type is not assignable” root cause and duped vite copies, and common fixes (dedupe/overrides). [2]
  • Community threads (Vitest/StackOverflow) with the same TS error and suggested resolutions (delete node_modules, dedupe, pin/resolve versions, or cast). [3][4]

Would you like me to inspect your package.json / npm ls output and suggest exact overrides/commands for your project?


Remove the double type cast and align types properly.

The as unknown as PluginOption cast masks a type incompatibility. The mincho plugin exports a custom Plugin interface from packages/vite/src/types.ts rather than using Vite's Plugin type. While structurally compatible, they are nominally different types, which is why the double assertion is needed.

To fix:

  1. Export PluginOption from the mincho vite package by importing and re-exporting Vite's types, or update packages/vite/src/types.ts to extend/reference Vite's types directly rather than defining a custom Plugin interface.
  2. Declare vite as a peerDependency in packages/vite/package.json to ensure type alignment across the package boundary.
  3. Remove the cast from examples/react-oxc/vite.config.ts line 9 once the type is properly aligned.

This ensures type safety and makes the plugin's contract with Vite explicit.

🤖 Prompt for AI Agents
In examples/react-oxc/vite.config.ts around line 9, the use of "as unknown as
PluginOption" masks a real type mismatch between the mincho plugin’s custom
Plugin type and Vite’s PluginOption; fix by updating the mincho vite package so
its types align with Vite: modify packages/vite/src/types.ts to import and
re-export Vite’s Plugin/PluginOption (or make the custom interface
extend/reference Vite’s Plugin type) and ensure the package’s public typings
export that PluginOption, add "vite" as a peerDependency in
packages/vite/package.json so consumers share the same Vite types, then remove
the double type assertion from examples/react-oxc/vite.config.ts once the
package-level types match.

react(),
],
})
7 changes: 5 additions & 2 deletions packages/css/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"files": [],
"compilerOptions": {
"composite": true
},
"references": [
{
"path": "../../configs/vite-config-custom"
},
{
"path": "../transform-to-vanilla"
},
{
{
"path": "./tsconfig.node.json"
},
{
{
"path": "./tsconfig.lib.json"
}
]
Expand Down
1 change: 1 addition & 0 deletions packages/css/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "tsconfig-custom/tsconfig.base.json",
"compilerOptions": {
"composite": true,
"rootDir": "./src",
"baseUrl": "./",
"paths": { /* Specify a set of entries that re-map imports to additional lookup locations. */
Expand Down
1 change: 1 addition & 0 deletions packages/integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@babel/core": "^7.28.5",
"@babel/plugin-syntax-jsx": "^7.27.1",
"@mincho-js/babel": "workspace:^",
"@mincho-js/oxc": "workspace:^",
"@vanilla-extract/integration": "^8.0.4",
"esbuild": "^0.25.11"
},
Expand Down
Loading
Loading