Skip to content

Commit

Permalink
Update vite.config.ts
Browse files Browse the repository at this point in the history
  • 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.
39 changes: 27 additions & 12 deletions vite.config.githubpage.ts
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;
});

0 comments on commit 038c618

Please sign in to comment.