F: Add react-compiler to build toolchain
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run

This commit is contained in:
Ivan 2024-12-13 13:55:26 +03:00
parent 6da40bc09b
commit 254b6a64d5
14 changed files with 43 additions and 5 deletions

View File

@ -60,6 +60,7 @@ This readme file is used mostly to document project dependencies and conventions
- eslint-plugin-simple-import-sort
- eslint-plugin-react-hooks
- eslint-plugin-tsdoc
- babel-plugin-react-compiler
- vite
- jest
- ts-jest

View File

@ -41,6 +41,7 @@
"@typescript-eslint/parser": "^8.0.1",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"babel-plugin-react-compiler": "^19.0.0-beta-37ed2a7-20241206",
"eslint": "^9.16.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-compiler": "^19.0.0-beta-37ed2a7-20241206",
@ -4008,6 +4009,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/babel-plugin-react-compiler": {
"version": "19.0.0-beta-37ed2a7-20241206",
"resolved": "https://registry.npmjs.org/babel-plugin-react-compiler/-/babel-plugin-react-compiler-19.0.0-beta-37ed2a7-20241206.tgz",
"integrity": "sha512-nnkrHpeDKM8A5laq9tmFvvGbbDQ7laGfQLp50cvCkCXmWrPcZdCtaQpNh8UJS/yLREJnv2R4JDL5ADfxyAn+yQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@babel/types": "^7.19.0"
}
},
"node_modules/babel-preset-current-node-syntax": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz",

View File

@ -45,6 +45,7 @@
"@typescript-eslint/parser": "^8.0.1",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"babel-plugin-react-compiler": "^19.0.0-beta-37ed2a7-20241206",
"eslint": "^9.16.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-compiler": "^19.0.0-beta-37ed2a7-20241206",

View File

@ -1,4 +1,5 @@
'use client';
'use no memo';
import {
ColumnSort,

View File

@ -1,4 +1,5 @@
'use client';
'use no memo';
import { Table } from '@tanstack/react-table';
import clsx from 'clsx';

View File

@ -1,3 +1,5 @@
'use no memo';
import { Table } from '@tanstack/react-table';
import CheckboxTristate from '@/components/ui/CheckboxTristate';

View File

@ -1,3 +1,5 @@
'use no memo';
import { Row } from '@tanstack/react-table';
import Checkbox from '@/components/ui/Checkbox';

View File

@ -1,3 +1,5 @@
'use no memo';
import { Column } from '@tanstack/react-table';
import { IconSortAsc, IconSortDesc } from '@/components/Icons';

View File

@ -1,3 +1,5 @@
'use no memo';
import { Cell, flexRender, Row, Table } from '@tanstack/react-table';
import clsx from 'clsx';

View File

@ -1,3 +1,5 @@
'use no memo';
import { flexRender, Header, HeaderGroup, Table } from '@tanstack/react-table';
interface TableFooterProps<TData> {

View File

@ -1,3 +1,5 @@
'use no memo';
import { flexRender, Header, HeaderGroup, Table } from '@tanstack/react-table';
import SelectAll from './SelectAll';

View File

@ -1,7 +1,7 @@
'use client';
import clsx from 'clsx';
import { useEffect, useMemo, useState } from 'react';
import { useEffect, useLayoutEffect, useMemo, useState } from 'react';
import { toast } from 'react-toastify';
import { IconChild, IconPredecessor, IconSave } from '@/components/Icons';
@ -89,9 +89,9 @@ function FormConstituenta({
setForceComment(false);
setLocalParse(undefined);
}
}, [state, schema, toggleReset]);
}, [state, schema, toggleReset, setIsModified]);
useEffect(() => {
useLayoutEffect(() => {
if (!state) {
setIsModified(false);
return;

View File

@ -293,7 +293,7 @@ export const RSEditState = ({
const handleRenameCst = useCallback(
(data: ICstRenameData) => {
const oldAlias = renameInitialData!.alias;
const oldAlias = renameInitialData?.alias ?? '';
model.cstRename(data, () => toast.success(information.renameComplete(oldAlias, data.alias)));
},
[model, renameInitialData]

View File

@ -4,6 +4,10 @@ import { defineConfig, loadEnv, PluginOption } from 'vite';
import { dependencies } from './package.json';
const reactCompilerConfig = {
/* ... */
};
// Packages to include in main app bundle
const inlinePackages = ['react', 'react-router', 'react-dom'];
@ -18,7 +22,14 @@ export default ({ mode }: { mode: string }) => {
};
return defineConfig({
appType: 'spa',
plugins: [react(), muteWarningsPlugin(warningsToIgnore)],
plugins: [
react({
babel: {
plugins: [['babel-plugin-react-compiler', reactCompilerConfig]]
}
}),
muteWarningsPlugin(warningsToIgnore)
],
server: {
port: Number(process.env.VITE_PORTAL_FRONT_PORT)
},