vite.config.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { defineConfig } from 'vite'
  2. import { resolve } from 'node:path'
  3. import { fileURLToPath } from 'node:url'
  4. const demoRoot = fileURLToPath(new URL('.', import.meta.url))
  5. const excalidrawStub = resolve(demoRoot, '../../scripts/excalidraw-iife-stub.ts')
  6. export default defineConfig({
  7. resolve: {
  8. alias: {
  9. // The component demo publishes script-tag and framework examples together.
  10. // Keep its production build independent from Excalidraw's React peers and
  11. // let core render .excalidraw through the built-in offline SVG fallback.
  12. '@excalidraw/excalidraw': excalidrawStub
  13. }
  14. },
  15. server: {
  16. host: '127.0.0.1'
  17. },
  18. preview: {
  19. host: '127.0.0.1'
  20. },
  21. build: {
  22. rollupOptions: {
  23. input: {
  24. index: resolve(demoRoot, 'index.html'),
  25. jquery: resolve(demoRoot, 'jquery.html'),
  26. 'custom-element': resolve(demoRoot, 'custom-element.html'),
  27. 'manual-js': resolve(demoRoot, 'manual-js.html'),
  28. 'manual-iife': resolve(demoRoot, 'manual-iife.html'),
  29. 'svelte-action': resolve(demoRoot, 'svelte-action.html'),
  30. vue3: resolve(demoRoot, 'vue3.html')
  31. }
  32. }
  33. }
  34. })