mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
feat(web): vite
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
const path = require("path");
|
|
||||||
module.exports = {
|
|
||||||
webpack: {
|
|
||||||
configure: (webpackConfig) => {
|
|
||||||
// Because CEF has issues with loading source maps properly atm,
|
|
||||||
// lets use the best we can get in line with `eval-source-map`
|
|
||||||
if (webpackConfig.mode === 'development' && process.env.IN_GAME_DEV) {
|
|
||||||
webpackConfig.devtool = 'eval-source-map'
|
|
||||||
webpackConfig.output.path = path.join(__dirname, 'build')
|
|
||||||
}
|
|
||||||
|
|
||||||
return webpackConfig
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
devServer: (devServerConfig) => {
|
|
||||||
if (process.env.IN_GAME_DEV) {
|
|
||||||
// Used for in-game dev mode
|
|
||||||
devServerConfig.devMiddleware.writeToDisk = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return devServerConfig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
13
web/index.html
Normal file
13
web/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>NUI React Boilerplate</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -19,20 +19,20 @@
|
|||||||
"@types/node": "^16.11.26",
|
"@types/node": "^16.11.26",
|
||||||
"@types/react": "^17.0.43",
|
"@types/react": "^17.0.43",
|
||||||
"@types/react-dom": "^17.0.14",
|
"@types/react-dom": "^17.0.14",
|
||||||
|
"@vitejs/plugin-react": "^1.3.2",
|
||||||
"framer-motion": "^6.2.8",
|
"framer-motion": "^6.2.8",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-markdown": "^8.0.1",
|
"react-markdown": "^8.0.1",
|
||||||
"react-scripts": "5.0.0",
|
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.6.3",
|
||||||
|
"vite": "^2.9.13",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "cross-env PUBLIC_URL=/ craco start",
|
"start": "vite",
|
||||||
"start:game": "cross-env IN_GAME_DEV=1 craco start",
|
"start:game": "vite build --watch",
|
||||||
"build": "rimraf build && craco build",
|
"build": "tsc && vite build",
|
||||||
"test": "craco test",
|
"preview": "vite preview"
|
||||||
"eject": "react-scripts eject"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
@@ -56,7 +56,6 @@
|
|||||||
"@babel/core": ">=7.0.0 <8.0.0",
|
"@babel/core": ">=7.0.0 <8.0.0",
|
||||||
"@babel/plugin-syntax-flow": "^7.14.5",
|
"@babel/plugin-syntax-flow": "^7.14.5",
|
||||||
"@babel/plugin-transform-react-jsx": "^7.14.9",
|
"@babel/plugin-transform-react-jsx": "^7.14.9",
|
||||||
"@craco/craco": "^6.4.3",
|
|
||||||
"@testing-library/dom": "^8.11.4",
|
"@testing-library/dom": "^8.11.4",
|
||||||
"autoprefixer": "^10.0.2",
|
"autoprefixer": "^10.0.2",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
|
|||||||
8986
web/pnpm-lock.yaml
generated
8986
web/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<title>NUI React Boilerplate</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></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`.
|
|
||||||
-->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
1
web/src/react-app-env.d.ts
vendored
1
web/src/react-app-env.d.ts
vendored
@@ -1 +0,0 @@
|
|||||||
/// <reference types="react-scripts" />
|
|
||||||
1
web/src/vite-env.d.ts
vendored
Normal file
1
web/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/// <reference types="vite/client" />
|
||||||
@@ -1,26 +1,21 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es5",
|
"target": "ESNext",
|
||||||
"lib": [
|
"useDefineForClassFields": true,
|
||||||
"dom",
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||||
"dom.iterable",
|
"allowJs": false,
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"module": "ESNext",
|
||||||
"module": "esnext",
|
"moduleResolution": "Node",
|
||||||
"moduleResolution": "node",
|
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["src"],
|
||||||
"src"
|
"references": [{ "path": "./tsconfig.node.json" }]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|||||||
8
web/tsconfig.node.json
Normal file
8
web/tsconfig.node.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"composite": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node"
|
||||||
|
},
|
||||||
|
"include": ["vite.config.ts"]
|
||||||
|
}
|
||||||
15
web/vite.config.ts
Normal file
15
web/vite.config.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
base: "./",
|
||||||
|
build: {
|
||||||
|
outDir: "build",
|
||||||
|
target: "esnext",
|
||||||
|
},
|
||||||
|
esbuild: {
|
||||||
|
logOverride: { "this-is-undefined-in-esm": "silent" },
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user