-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(frontend): migrate from Create React App to Vite
- add Vite packages and config. - update build scripts. - update ESLint config. - update SVG shape imports. - remove the old Express middleware proxy. - clean up unused dependencies.
- Loading branch information
1 parent
0f0e031
commit f22c389
Showing
13 changed files
with
2,669 additions
and
10,120 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -44,3 +44,6 @@ terracotta.sqlite | |
__pycache__ | ||
*.egg-info | ||
*.pyc | ||
|
||
# frontend config | ||
proxy-table.json |
This file contains 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 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,16 @@ | ||
{ | ||
"/vector": { | ||
"target": "http://localhost:8080", | ||
"changeOrigin": true, | ||
"pathRewrite": { | ||
"^/vector": "/" | ||
} | ||
}, | ||
"/api": { | ||
"target": "http://localhost:8888", | ||
"changeOrigin": true, | ||
"pathRewrite": { | ||
"^/api": "/" | ||
} | ||
} | ||
} |
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"module": "ESNext", | ||
"moduleResolution": "Node", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["vite.config.ts"] | ||
} |
This file contains 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,2 @@ | ||
/// <reference types="vite/client" /> | ||
/// <reference types="vite-plugin-svgr/client" /> |
This file contains 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,36 @@ | ||
import react from '@vitejs/plugin-react'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { defineConfig } from 'vite'; | ||
import svgrPlugin from 'vite-plugin-svgr'; | ||
import viteTsconfigPaths from 'vite-tsconfig-paths'; | ||
|
||
/** | ||
* To set up a development proxy, create and edit the file dev-proxy/proxy-table.json | ||
* You can copy and rename one of the included examples. | ||
* See https://vitejs.dev/config/server-options.html#server-proxy for syntax | ||
*/ | ||
let devProxy; | ||
try { | ||
devProxy = JSON.parse( | ||
fs.readFileSync(path.resolve(__dirname, 'dev-proxy/proxy-table.json')).toString(), | ||
); | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
// no dev proxy config, do nothing | ||
} else { | ||
console.error('Invalid JSON file: dev-proxy/proxy-table.json'); | ||
} | ||
} | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react(), viteTsconfigPaths(), svgrPlugin()], | ||
build: { | ||
outDir: 'build', | ||
}, | ||
server: { | ||
open: true, | ||
proxy: devProxy, | ||
}, | ||
}); |