mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-22 07:40:32 +00:00
wip
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
"deepdash": "^5.3.9",
|
"deepdash": "^5.3.9",
|
||||||
"dependency-graph": "^0.11.0",
|
"dependency-graph": "^0.11.0",
|
||||||
"dotenv-webpack": "^8.0.1",
|
"dotenv-webpack": "^8.0.1",
|
||||||
|
"esbuild-plugin-react-virtualized": "^1.0.5",
|
||||||
"eslint": "^8.33.0",
|
"eslint": "^8.33.0",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"flat": "^5.0.2",
|
"flat": "^5.0.2",
|
||||||
@@ -107,6 +108,7 @@
|
|||||||
"react-use": "^13.26.1",
|
"react-use": "^13.26.1",
|
||||||
"react-use-context-menu": "^0.1.4",
|
"react-use-context-menu": "^0.1.4",
|
||||||
"react-virtualized": "^9.22.3",
|
"react-virtualized": "^9.22.3",
|
||||||
|
"regenerator-runtime": "^0.14.1",
|
||||||
"redux": "^4.2.1",
|
"redux": "^4.2.1",
|
||||||
"redux-devtools": "^3.5.0",
|
"redux-devtools": "^3.5.0",
|
||||||
"redux-persist": "^6.0.0",
|
"redux-persist": "^6.0.0",
|
||||||
@@ -125,6 +127,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^4.3.4",
|
||||||
|
"@vitejs/plugin-legacy": "^5.4.2",
|
||||||
"eslint-config-react-app": "^7.0.1",
|
"eslint-config-react-app": "^7.0.1",
|
||||||
"vite": "^5.1.6"
|
"vite": "^5.1.6"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
import './wdyr';
|
import './wdyr';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
import('@welldone-software/why-did-you-render').then(({ default: whyDidYouRender }) => {
|
import('@welldone-software/why-did-you-render').then(({ default: whyDidYouRender }) => {
|
||||||
if (whyDidYouRender) {
|
if (whyDidYouRender) {
|
||||||
|
|||||||
@@ -1,57 +1,20 @@
|
|||||||
|
// @ts-nocheck
|
||||||
import react from '@vitejs/plugin-react';
|
import react from '@vitejs/plugin-react';
|
||||||
import { readFile } from 'node:fs/promises';
|
import legacy from '@vitejs/plugin-legacy';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { defineConfig, loadEnv, Plugin } from 'vite';
|
import { defineConfig, loadEnv, type PluginOption } from 'vite';
|
||||||
|
import fixReactVirtualized from 'esbuild-plugin-react-virtualized';
|
||||||
|
|
||||||
const allowedEnvPrefixes = ['VITE_', 'REACT_APP_', 'PUBLIC_URL'];
|
const allowedEnvPrefixes = ['VITE_', 'REACT_APP_', 'PUBLIC_URL'];
|
||||||
|
|
||||||
const reactVirtualizedCompat = (): Plugin => ({
|
const pickClientEnv = (env: Record<string, string>) =>
|
||||||
name: 'react-virtualized-compat',
|
Object.keys(env).reduce<Record<string, string>>((acc, key) => {
|
||||||
enforce: 'pre',
|
if (allowedEnvPrefixes.some((prefix) => key.startsWith(prefix))) {
|
||||||
transform(code, id) {
|
acc[key] = env[key];
|
||||||
const needsShim =
|
|
||||||
id.includes(
|
|
||||||
'node_modules/react-virtualized/dist/es/WindowScroller/utils/onScroll.js',
|
|
||||||
) ||
|
|
||||||
id.includes(
|
|
||||||
'node_modules/react-virtualized/dist/es/WindowScroller/utils/dimensions.js',
|
|
||||||
);
|
|
||||||
if (needsShim) {
|
|
||||||
console.info('Applying react-virtualized shim:', id);
|
|
||||||
return code.replace(
|
|
||||||
/import \{ bpfrpt_proptype_WindowScroller \} from "\.\.\/WindowScroller\.js";/g,
|
|
||||||
'const bpfrpt_proptype_WindowScroller = null;',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return acc;
|
||||||
},
|
}, {});
|
||||||
});
|
|
||||||
|
|
||||||
const reactVirtualizedOptimizePatch = () => ({
|
|
||||||
name: 'react-virtualized-optimize-patch',
|
|
||||||
setup(build) {
|
|
||||||
const filter =
|
|
||||||
/react-virtualized\/dist\/es\/WindowScroller\/utils\/(onScroll|dimensions)\.js$/;
|
|
||||||
build.onLoad({ filter }, async args => {
|
|
||||||
const contents = await readFile(args.path, 'utf-8');
|
|
||||||
return {
|
|
||||||
contents: contents.replace(
|
|
||||||
/import \{ bpfrpt_proptype_WindowScroller \} from "\.\.\/WindowScroller\.js";/g,
|
|
||||||
'const bpfrpt_proptype_WindowScroller = null;',
|
|
||||||
),
|
|
||||||
loader: 'js',
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const pickClientEnv = (env: Record<string, string>) =>
|
|
||||||
Object.fromEntries(
|
|
||||||
Object.entries(env).filter(([key]) =>
|
|
||||||
allowedEnvPrefixes.some(prefix => key.startsWith(prefix)),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode }) => {
|
export default defineConfig(({ mode }) => {
|
||||||
@@ -59,9 +22,16 @@ export default defineConfig(({ mode }) => {
|
|||||||
const env = loadEnv(mode, rootDir, '');
|
const env = loadEnv(mode, rootDir, '');
|
||||||
const clientEnv = pickClientEnv(env);
|
const clientEnv = pickClientEnv(env);
|
||||||
const port = Number(env.PORT) || 4000;
|
const port = Number(env.PORT) || 4000;
|
||||||
|
const plugins: PluginOption[] = [
|
||||||
|
react(),
|
||||||
|
legacy({
|
||||||
|
targets: ['defaults', 'not IE 11'],
|
||||||
|
additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [react(), reactVirtualizedCompat()],
|
plugins,
|
||||||
root: rootDir,
|
root: rootDir,
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
@@ -92,9 +62,8 @@ export default defineConfig(({ mode }) => {
|
|||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
esbuildOptions: {
|
esbuildOptions: {
|
||||||
plugins: [reactVirtualizedOptimizePatch()],
|
plugins: [fixReactVirtualized],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
1731
pnpm-lock.yaml
generated
1731
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user