vite.config.ts 543 B

1234567891011121314151617181920212223242526272829
  1. import { resolve } from "path"
  2. import { defineConfig } from "vite"
  3. export default defineConfig({
  4. build: {
  5. outDir: "./dist",
  6. emptyOutDir: true,
  7. lib: {
  8. entry: {
  9. web: "./src/web/index.ts",
  10. node: "./src/node/index.ts",
  11. },
  12. name: "js-sandbox",
  13. formats: ["es", "cjs"],
  14. },
  15. rollupOptions: {
  16. external: ["module"],
  17. },
  18. },
  19. test: {
  20. environment: "node",
  21. setupFiles: ["./setupFiles.ts"],
  22. },
  23. resolve: {
  24. alias: {
  25. "~": resolve(__dirname, "./src"),
  26. },
  27. },
  28. })