Browse Source

feat: switch to vite 6.1

pull/417/head
Dan Ditomaso 1 year ago
parent
commit
8105f89c55
  1. 19
      package.json
  2. 1029
      pnpm-lock.yaml
  3. 30
      rsbuild.config.ts
  4. 53
      vite.config.ts

19
package.json

@ -5,13 +5,13 @@
"description": "Meshtastic web client",
"license": "GPL-3.0-only",
"scripts": {
"build": "pnpm check && rsbuild build",
"build:analyze": "BUNDLE_ANALYZE=true rsbuild build",
"build": "vite build",
"build:analyze": "BUNDLE_ANALYZE=true vite build",
"check": "biome check src/",
"check:fix": "pnpm check --write src/",
"format": "biome format --write src/",
"dev": "rsbuild dev --open",
"preview": "rsbuild preview",
"dev": "vite dev --open",
"preview": "vite preview",
"package": "gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && tar -cvf dist/build.tar -C ./dist/output/ $(ls ./dist/output/)",
"postinstall": "npx simple-git-hooks"
},
@ -19,7 +19,10 @@
"pre-commit": "npm run check:fix && npm run format"
},
"lint-staged": {
"*.{ts,tsx}": ["npm run check:fix", "npm run format"]
"*.{ts,tsx}": [
"npm run check:fix",
"npm run format"
]
},
"repository": {
"type": "git",
@ -71,8 +74,6 @@
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@rsbuild/core": "^1.2.3",
"@rsbuild/plugin-react": "^1.1.0",
"@types/chrome": "^0.0.299",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.12.0",
@ -80,6 +81,7 @@
"@types/react-dom": "^19.0.3",
"@types/w3c-web-serial": "^1.0.7",
"@types/web-bluetooth": "^0.0.20",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20",
"gzipper": "^8.2.0",
"postcss": "^8.5.1",
@ -88,7 +90,8 @@
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"tar": "^7.4.3",
"typescript": "^5.7.3"
"typescript": "^5.7.3",
"vite": "^6.1.0"
},
"packageManager": "[email protected]"
}

1029
pnpm-lock.yaml

File diff suppressed because it is too large

30
rsbuild.config.ts

@ -1,30 +0,0 @@
import { execSync } from "node:child_process";
import { defineConfig } from "@rsbuild/core";
import { pluginReact } from "@rsbuild/plugin-react";
let hash = "";
try {
hash = execSync("git rev-parse --short HEAD").toString().trim();
} catch (error) {
hash = "DEV";
}
export default defineConfig({
plugins: [pluginReact()],
source: {
define: {
"process.env.COMMIT_HASH": JSON.stringify(hash),
},
alias: {
"@app": "./src",
"@pages": "./src/pages",
"@components": "./src/components",
"@core": "./src/core",
"@layouts": "./src/layouts",
},
},
html: {
title: "Meshtastic Web",
},
});

53
vite.config.ts

@ -1,45 +1,30 @@
import { execSync } from "node:child_process";
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import { visualizer } from "rollup-plugin-visualizer";
import { defineConfig } from "vite";
import EnvironmentPlugin from "vite-plugin-environment";
let hash = "";
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { execSync } from 'node:child_process';
import path from 'path';
let hash = '';
try {
hash = execSync("git rev-parse --short HEAD").toString().trim();
hash = execSync('git rev-parse --short HEAD').toString().trim();
} catch (error) {
hash = "DEVELOPMENT";
hash = 'DEV';
}
export default defineConfig({
plugins: [
react(),
EnvironmentPlugin({
COMMIT_HASH: hash,
}),
// VitePWA({
// registerType: "autoUpdate",
// devOptions: {
// enabled: true
// }
// })
],
build: {
target: "esnext",
assetsDir: "",
rollupOptions: {
plugins: [visualizer()],
},
plugins: [react()],
define: {
'process.env.COMMIT_HASH': JSON.stringify(hash),
},
resolve: {
alias: {
"@app": resolve(__dirname, "./src"),
"@pages": resolve(__dirname, "./src/pages"),
"@components": resolve(__dirname, "./src/components"),
"@core": resolve(__dirname, "./src/core"),
"@layouts": resolve(__dirname, "./src/layouts"),
'@app': path.resolve(__dirname, './src'),
'@pages': path.resolve(__dirname, './src/pages'),
'@components': path.resolve(__dirname, './src/components'),
'@core': path.resolve(__dirname, './src/core'),
'@layouts': path.resolve(__dirname, './src/layouts'),
},
},
});
server: {
port: 3000
}
});
Loading…
Cancel
Save