Guest User

Untitled

a guest
Mar 29th, 2023
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <reference types="vitest" />
  2. /// <reference types="vite/client" />
  3.  
  4. import react from "@vitejs/plugin-react";
  5. import { setupPlugin } from "gsmk-web/vite";
  6. import jotaiDebugLabel from "jotai/babel/plugin-debug-label";
  7. import jotaiReactRefresh from "jotai/babel/plugin-react-refresh";
  8. import path from "path";
  9. import includePaths from "rollup-plugin-includepaths";
  10. import { defineConfig, ProxyOptions } from "vite";
  11. import tsconfigPaths from "vite-tsconfig-paths";
  12. import { configDefaults } from "vitest/config";
  13.  
  14. const defaultProxy = "https://dev.overwatch.gsmk.de/";
  15.  
  16. const includePathOptions = {
  17.   include: { "~shared": "./src/shared" },
  18.   paths: ["src", "~/*", "~shared/*", "./", "src/shared"],
  19. };
  20.  
  21. const aliases = {
  22.   "~/shared": "src/shared",
  23. };
  24.  
  25. const resolvedAliases = Object.fromEntries(
  26.   Object.entries(aliases).map(([key, value]) => [
  27.     key,
  28.     path.resolve(__dirname, value),
  29.   ])
  30. );
  31.  
  32. export default defineConfig({
  33.   build: {
  34.     rollupOptions: {
  35.       external: ["~/shared/components/test"],
  36.     },
  37.   },
  38.   plugins: [
  39.     react({ babel: { plugins: [jotaiDebugLabel, jotaiReactRefresh] } }),
  40.     setupPlugin(),
  41.     tsconfigPaths(),
  42.     includePaths(includePathOptions),
  43.   ],
  44.   server: {
  45.     proxy: createProxy(),
  46.   },
  47.   resolve: {
  48.     alias: {
  49.       ...resolvedAliases,
  50.       "~": path.resolve(__dirname, "./src"),
  51.     },
  52.   },
  53.   test: {
  54.     globals: true,
  55.     environment: "jsdom",
  56.     setupFiles: ["./src/setupTests.ts"],
  57.     exclude: [...configDefaults.exclude, "./src/e2e/**"],
  58.   },
  59. });
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment