-
-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: Integrate OXC for faster builds and improved Mincho transformations #281
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
Open
sangkukbae
wants to merge
15
commits into
main
Choose a base branch
from
feat/oxc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 fb3547b
Feat: Add new example and package for OXC integration with Mincho.js
sangkukbae 26dda39
Chore: Update TypeScript configuration files to include new package a…
sangkukbae 601c254
Chore: Upgrade ESLint and related dependencies to version 9.39.0 acro…
sangkukbae 06b5c25
Chore: Update package.json and tsconfig.lib.json to include type defi…
sangkukbae 40d180b
Chore: Update TypeScript and ESLint configurations for OXC, including…
sangkukbae 97423db
Chore: Add tsconfig.eslint.json path to OXC TypeScript configuration …
sangkukbae 1905bff
Chore: Update output directory and build info file in tsconfig.eslint…
sangkukbae 878b60a
Feat: Enhance minchoTransform to support CSS extraction and style imp…
sangkukbae fa61197
Chore: Refactor package.json in debug-log to streamline type definiti…
sangkukbae e2603f6
Chore: Update NodeBuilder to include 'ACTIONS' runtime environment in…
sangkukbae 5ba2bcf
Chore: Refactor TypeScript configurations and update .gitignore for i…
sangkukbae f073162
Chore: Update package.json and debug-log to replace deep-diff with je…
sangkukbae 6ae70aa
Chore: Add tsconfig.test.json path to OXC TypeScript configuration fo…
sangkukbae 56b3d6e
Chore: Update TypeScript configurations in OXC to extend base config …
sangkukbae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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... | ||
| }, | ||
| }, | ||
| ]) | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'] | ||
| }, | ||
| }, | ||
| }, | ||
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "files": [], | ||
| "references": [ | ||
| { "path": "./tsconfig.app.json" }, | ||
| { "path": "./tsconfig.node.json" } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| react(), | ||
| ], | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Investigate the double type assertion.
The
as unknown as PluginOptioncast suggests a type incompatibility betweenminchoVitePlugin()'s return type and Vite'sPluginOption. Type assertions like this can mask type safety issues.Please verify that
minchoVitePluginreturns a type compatible with Vite's plugin system. If there's a type definition mismatch, consider:Run the following to check the plugin's type definition:
🏁 Script executed:
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:
Length of output: 1189
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 292
🏁 Script executed:
Length of output: 113
🏁 Script executed:
Length of output: 339
🏁 Script executed:
Length of output: 36
🏁 Script executed:
Length of output: 409
🏁 Script executed:
Length of output: 799
🏁 Script executed:
Length of output: 973
🏁 Script executed:
Length of output: 846
🏁 Script executed:
Length of output: 605
🏁 Script executed:
Length of output: 834
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 176
🏁 Script executed:
Length of output: 196
🏁 Script executed:
Length of output: 465
🏁 Script executed:
Length of output: 855
🏁 Script executed:
Length of output: 387
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 2950
🏁 Script executed:
Length of output: 76
🏁 Script executed:
Length of output: 69
🏁 Script executed:
Length of output: 99
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 684
🏁 Script executed:
Length of output: 322
🏁 Script executed:
Length of output: 559
🏁 Script executed:
Length of output: 1394
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 274
🏁 Script executed:
Length of output: 26
🏁 Script executed:
Length of output: 1428
🏁 Script executed:
Length of output: 1300
🏁 Script executed:
Length of output: 18731
🏁 Script executed:
Length of output: 18
🏁 Script executed:
Length of output: 409
🏁 Script executed:
Length of output: 18626
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 149
🏁 Script executed:
Length of output: 456
🏁 Script executed:
Length of output: 941
🏁 Script executed:
Length of output: 2063
🏁 Script executed:
Length of output: 0
🏁 Script executed:
Length of output: 10
🏁 Script executed:
Length of output: 2
🏁 Script executed:
Length of output: 1394
🏁 Script executed:
Length of output: 559
🏁 Script executed:
Length of output: 1394
🏁 Script executed:
Length of output: 721
🏁 Script executed:
Length of output: 623
🏁 Script executed:
Length of output: 171
🏁 Script executed:
Length of output: 171
🏁 Script executed:
Length of output: 98
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 143
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 64
🏁 Script executed:
Length of output: 1010
🏁 Script executed:
Length of output: 11
🏁 Script executed:
Length of output: 312
🏁 Script executed:
Length of output: 1394
🏁 Script executed:
Length of output: 85
🏁 Script executed:
Length of output: 1766
🏁 Script executed:
Length of output: 504
🏁 Script executed:
Length of output: 1788
🏁 Script executed:
Length of output: 508
🏁 Script executed:
Length of output: 84
🏁 Script executed:
Length of output: 135
🏁 Script executed:
Length of output: 96
🏁 Script executed:
Length of output: 1934
🏁 Script executed:
Length of output: 318
🏁 Script executed:
Length of output: 468
🏁 Script executed:
Length of output: 322
🏁 Script executed:
Length of output: 322
🌐 Web query:
💡 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:
💡 Result:
Short answer
Why you see type errors
Practical fixes
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:
💡 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
How to fix (try in this order)
References
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 PluginOptioncast masks a type incompatibility. The mincho plugin exports a customPlugininterface frompackages/vite/src/types.tsrather than using Vite'sPlugintype. While structurally compatible, they are nominally different types, which is why the double assertion is needed.To fix:
PluginOptionfrom the mincho vite package by importing and re-exporting Vite's types, or updatepackages/vite/src/types.tsto extend/reference Vite's types directly rather than defining a customPlugininterface.viteas a peerDependency inpackages/vite/package.jsonto ensure type alignment across the package boundary.examples/react-oxc/vite.config.tsline 9 once the type is properly aligned.This ensures type safety and makes the plugin's contract with Vite explicit.
🤖 Prompt for AI Agents