vite.config.ts 450 B

12345678910111213141516171819202122232425
  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.ts",
  10. node: "./src/node.ts",
  11. },
  12. name: "js-sandbox",
  13. formats: ["es", "cjs"],
  14. },
  15. rollupOptions: {
  16. external: ["vm"],
  17. },
  18. },
  19. resolve: {
  20. alias: {
  21. "~": resolve(__dirname, "./src"),
  22. },
  23. },
  24. })