2022-07-12 08:55:28 +00:00
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
import path from "path";
|
|
|
|
import { VitePWA } from "vite-plugin-pwa";
|
|
|
|
import { visualizer } from "rollup-plugin-visualizer";
|
|
|
|
|
|
|
|
export default defineConfig(({ command }) => {
|
|
|
|
const isDev = command !== "build";
|
|
|
|
if (isDev) {
|
|
|
|
// Terminate the watcher when Phoenix quits
|
|
|
|
process.stdin.on("close", () => {
|
|
|
|
process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
process.stdin.resume();
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
plugins: [
|
|
|
|
vue(),
|
|
|
|
VitePWA({
|
|
|
|
// registerType: "autoUpdate",
|
|
|
|
strategies: "injectManifest",
|
|
|
|
srcDir: "src",
|
|
|
|
filename: "service-worker.ts",
|
|
|
|
// injectRegister: "auto",
|
2022-08-12 14:46:44 +00:00
|
|
|
// devOptions: {
|
|
|
|
// enabled: true,
|
|
|
|
// },
|
2022-07-12 08:55:28 +00:00
|
|
|
}),
|
|
|
|
visualizer(),
|
|
|
|
],
|
|
|
|
build: {
|
|
|
|
manifest: true,
|
|
|
|
outDir: path.resolve(__dirname, "../priv/static"),
|
|
|
|
emptyOutDir: true,
|
2022-10-05 10:13:19 +00:00
|
|
|
sourcemap: true,
|
2022-07-12 08:55:28 +00:00
|
|
|
rollupOptions: {
|
|
|
|
// overwrite default .html entry
|
|
|
|
input: {
|
|
|
|
main: "src/main.ts",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@": path.resolve(__dirname, "./src"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
css: {
|
|
|
|
preprocessorOptions: {
|
|
|
|
scss: {
|
|
|
|
sassOptions: {
|
|
|
|
quietDeps: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
test: {
|
|
|
|
environment: "jsdom",
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
"@": path.resolve(__dirname, "./src"),
|
|
|
|
},
|
|
|
|
},
|
2022-09-21 08:33:50 +00:00
|
|
|
coverage: {
|
|
|
|
reporter: ["text", "json", "html"],
|
|
|
|
},
|
2022-07-12 08:55:28 +00:00
|
|
|
setupFiles: path.resolve(__dirname, "./tests/unit/setup.ts"),
|
2022-08-26 14:08:58 +00:00
|
|
|
include: [path.resolve(__dirname, "./tests/unit/specs/**/*.spec.ts")],
|
2022-07-12 08:55:28 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
});
|