forked from wavebeem/pkmn.help
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ouv1hc
authored and
ouv1hc
committed
Dec 17, 2021
1 parent
ab8e69d
commit 038c618
Showing
1 changed file
with
27 additions
and
12 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 |
---|---|---|
@@ -1,19 +1,34 @@ | ||
import purgecss from "@fullhuman/postcss-purgecss"; | ||
import reactRefresh from "@vitejs/plugin-react-refresh"; | ||
import { Plugin } from "postcss"; | ||
import { defineConfig } from "vite"; | ||
import { defineConfig, UserConfigExport } from "vite"; | ||
import { VitePWA } from "vite-plugin-pwa"; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
css: { | ||
postcss: { | ||
plugins: [ | ||
purgecss({ | ||
content: ["./src/**/*.{ts,tsx,js}"], | ||
}) as Plugin, | ||
], | ||
export default defineConfig((env) => { | ||
const config: UserConfigExport = { | ||
build: { | ||
sourcemap: true, | ||
}, | ||
}, | ||
plugins: [reactRefresh()], | ||
base: '/pkmn.help/', | ||
plugins: [ | ||
reactRefresh(), | ||
VitePWA({ | ||
mode: env.mode !== "development" ? "production" : "development", | ||
includeAssets: ["data-pkmn.json"], | ||
}), | ||
], | ||
base: '/pkmn.help/', | ||
}; | ||
if (env.mode !== "development") { | ||
config.css = { | ||
postcss: { | ||
plugins: [ | ||
purgecss({ | ||
content: ["./index.html", "./src/**/*.{ts,tsx,js,html}"], | ||
}) as Plugin, | ||
], | ||
}, | ||
}; | ||
} | ||
return config; | ||
}); |