Skip to content

210-feat: React Compiler #254

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
'plugin:import/typescript',
'plugin:css-import-order/recommended',
],
plugins: ['react-refresh', 'css-import-order', 'sort-exports'],
plugins: ['react-refresh', 'css-import-order', 'sort-exports', 'eslint-plugin-react-compiler'],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down
645 changes: 413 additions & 232 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
"prepare": "husky"
},
"dependencies": {
"babel-plugin-react-compiler": "^0.0.0-experimental-938cd9a-20240601",
"classnames": "^2.5.1",
"dayjs": "^1.11.11",
"eslint-plugin-react-compiler": "^0.0.0-experimental-51a85ea-20240601",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you install this to dependencies not dev-dependencies instead?

"nextjs-toploader": "^1.6.12",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
1 change: 1 addition & 0 deletions src/app/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { c } from './use-c';
export { useCourseByTitle } from './use-course-by-title';
export { useDataByName } from './use-data-by-name';
export { useNearestCourse } from './use-nearest-course';
Expand Down
1 change: 1 addition & 0 deletions src/app/hooks/use-c/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { c } from './use-c';
6 changes: 6 additions & 0 deletions src/app/hooks/use-c/use-c.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { useState } from 'react';

export function c(size: number) {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useState(() => new Array(size))[0];
}
18 changes: 17 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ import path from 'path';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [react()],
plugins: [
react({
babel: {
plugins: [
[
'babel-plugin-react-compiler',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need it - we don't use babel, do we?

{
runtimeModule: '@/app/hooks',
environment: {
validateNoRefAccessRender: true,
},
},
],
],
},
}),
],
build: {
outDir: 'build',
},
Expand Down
Loading