mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
wip
This commit is contained in:
@@ -24,4 +24,4 @@ RUN pnpm run build:webapp
|
||||
FROM nginx
|
||||
|
||||
COPY ./packages/webapp/nginx/sites/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/packages/webapp/build /usr/share/nginx/html
|
||||
COPY --from=build /app/packages/webapp/dist /usr/share/nginx/html
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
<!doctype html>
|
||||
<html dir="ltr" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link
|
||||
rel="icon"
|
||||
href="%PUBLIC_URL%/favicons/favicon-32.ico"
|
||||
sizes="32x32"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Bigcapital Financial Managment Software"
|
||||
/>
|
||||
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> -->
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>Bigcapital</title>
|
||||
</head>
|
||||
<body class="bp4-dark">
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<div id="nprogress"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css"
|
||||
type="text/css"
|
||||
/>
|
||||
<script src="https://app.lemonsqueezy.com/js/lemon.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -62,9 +62,6 @@ const initialState = {
|
||||
warehouseTransfer: {
|
||||
tableSize: 'small',
|
||||
},
|
||||
projectTasks: {
|
||||
tableSize: 'small',
|
||||
},
|
||||
projectTasks: {
|
||||
tableSize: 'medium',
|
||||
},
|
||||
|
||||
100
packages/webapp/vite.config.ts
Normal file
100
packages/webapp/vite.config.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { defineConfig, loadEnv, Plugin } from 'vite';
|
||||
|
||||
const allowedEnvPrefixes = ['VITE_', 'REACT_APP_', 'PUBLIC_URL'];
|
||||
|
||||
const reactVirtualizedCompat = (): Plugin => ({
|
||||
name: 'react-virtualized-compat',
|
||||
enforce: 'pre',
|
||||
transform(code, id) {
|
||||
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;
|
||||
},
|
||||
});
|
||||
|
||||
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/
|
||||
export default defineConfig(({ mode }) => {
|
||||
const rootDir = __dirname;
|
||||
const env = loadEnv(mode, rootDir, '');
|
||||
const clientEnv = pickClientEnv(env);
|
||||
const port = Number(env.PORT) || 4000;
|
||||
|
||||
return {
|
||||
plugins: [react(), reactVirtualizedCompat()],
|
||||
root: rootDir,
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(rootDir, 'src'),
|
||||
'@public': path.resolve(rootDir, 'public'),
|
||||
path: 'path-browserify',
|
||||
},
|
||||
},
|
||||
define: {
|
||||
'process.env': {
|
||||
NODE_ENV: mode,
|
||||
PUBLIC_URL: clientEnv.PUBLIC_URL ?? '/',
|
||||
...clientEnv,
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: true,
|
||||
port,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: env.VITE_API_PROXY_TARGET || 'http://localhost:3000',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
},
|
||||
optimizeDeps: {
|
||||
esbuildOptions: {
|
||||
plugins: [reactVirtualizedOptimizePatch()],
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user