import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; import tailwindcss from "@tailwindcss/vite"; export default defineConfig({ plugins: [vue(), tailwindcss()], resolve: { alias: [ { // @nychthemeron/library's package.json "." export declares a // "development" condition pointing at ./src/index.ts, which // its published tarball doesn't include (only dist/, // src/assets/, src/components/ ship) — Vite picks that // condition first in dev mode and fails to resolve it before // ever trying "import". Alias straight past the exports map // to the working dist bundle. Anchored to match only the // bare specifier (not "@nychthemeron/library/style" etc, // which aren't affected — they don't declare a "development" // condition and must keep resolving through the real // exports map). find: /^@nychthemeron\/library$/, replacement: fileURLToPath( new URL("./node_modules/@nychthemeron/library/dist/index.js", import.meta.url), ), }, ], }, server: { proxy: { "/api": "http://localhost:3000", "/auth": "http://localhost:3000", "/admin": "http://localhost:3000", }, }, build: { outDir: "dist", rollupOptions: { output: { manualChunks: { vue: ["vue", "vue-router", "pinia"], nychthemeron: ["@nychthemeron/library"], }, entryFileNames: "js/[name]-[hash].js", chunkFileNames: "js/[name]-[hash].js", assetFileNames: "assets/[name]-[hash][extname]", }, }, }, });