Skip to content
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

Use Vite instead of CRA #2476

Open
wants to merge 2 commits into
base: future3/develop
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion docker/Dockerfile.webapp
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ COPY --chown=node:node ./src/webapp ./

RUN npm install

CMD ["npm", "start"]
# This assumes that the `start` script in `package.json` invokes `vite`.
CMD ["npm", "start", "--", "--host=0.0.0.0", "--port=3000", "--strictPort"]
2 changes: 2 additions & 0 deletions src/webapp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.swc
21 changes: 21 additions & 0 deletions src/webapp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<link rel="apple-touch-icon" href="/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="/manifest.json" />
<title>Phoniebox</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
21,835 changes: 6,638 additions & 15,197 deletions src/webapp/package-lock.json

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions src/webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@
"react-dom": "^17.0.2",
"react-i18next": "^12.3.1",
"react-router-dom": "^6.18.0",
"react-scripts": "^5.0.1",
"url": "^0.11.3",
"uuid": "^9.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"start": "vite",
"build": "vite build"
},
"eslintConfig": {
"extends": [
Expand All @@ -49,6 +46,11 @@
]
},
"devDependencies": {
"markdownlint-cli2": "^0.12.1"
"@swc/plugin-emotion": "^8.0.2",
"@vitejs/plugin-react-swc": "^3.7.2",
"eslint": "^8.57.1",
"eslint-config-react-app": "^7.0.1",
"markdownlint-cli2": "^0.12.1",
"vite-plugin-checker": "^0.8.0"
}
}
39 changes: 0 additions & 39 deletions src/webapp/public/index.html

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions src/webapp/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'vite'
import reactSWC from '@vitejs/plugin-react-swc'
import checker from 'vite-plugin-checker';

// https://vite.dev/config/
export default defineConfig({
build: {
outDir: 'build',
},
define: {
// Workaround for jszmq -> assert -> util
'process.env': {},
},
plugins: [
checker({
eslint: {
lintCommand: 'eslint "./src/**/*.{js,jsx}"',
},
}),
reactSWC({
plugins: [['@swc/plugin-emotion', {}]]
}),
],
server: {
open: true
}
})