env
This commit is contained in:
1 parent
8d3d764a0d
commit
0d41e7229b
4 files changed
+20
-14
No files matched your search
+14
-2
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import svgr from "vite-plugin-svgr";
|
||||
import path from "path";
|
||||
@@ -6,10 +6,22 @@ import { fileURLToPath } from "url";
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const publicReload = (): Plugin => ({
|
||||
name: "public-reload",
|
||||
configureServer(server) {
|
||||
// Watch all files under public and trigger a full reload on change
|
||||
server.watcher.add("public/**");
|
||||
const reload = () => server.ws.send({ type: "full-reload" });
|
||||
server.watcher.on("add", reload);
|
||||
server.watcher.on("change", reload);
|
||||
server.watcher.on("unlink", reload);
|
||||
},
|
||||
});
|
||||
|
||||
export default defineConfig(() => {
|
||||
return {
|
||||
base: "/",
|
||||
plugins: [svgr(), react()],
|
||||
plugins: [svgr(), react(), publicReload()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "src"),
|
||||
|
||||
Reference in new issue
Block a user