vite.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import wasm from 'vite-plugin-wasm'
  2. import glsl from 'vite-plugin-glsl'
  3. import topLevelAwait from 'vite-plugin-top-level-await'
  4. import { defineConfig } from 'vite'
  5. export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
  6. return {
  7. root: './',
  8. publicDir: './assets/',
  9. base: './',
  10. server:
  11. {
  12. host: true, // Open to local network and display URL
  13. open: !('SANDBOX_URL' in process.env || 'CODESANDBOX_HOST' in process.env) // Open if it's not a CodeSandbox
  14. },
  15. build:
  16. {
  17. outDir: './dist', // Output in the dist/ folder
  18. emptyOutDir: true, // Empty the folder first
  19. sourcemap: true // Add sourcemap
  20. },
  21. plugins:
  22. [
  23. wasm(), glsl(), topLevelAwait(),
  24. ]
  25. }
  26. })
  27. /*
  28. export default defineConfig(({ command, mode, isSsrBuild, isPreview }) => {
  29. return {
  30. 'rootDir': './jupiter-jazz/',
  31. 'publicDir': './jupiter-jazz/',
  32. 'mode': 'development',
  33. 'build': {
  34. 'rootDir': './jupiter-jazz/',
  35. 'publicDir': './jupiter-jazz/',
  36. 'target': 'modules',
  37. 'outDir': '../dist/'
  38. },
  39. 'server': {
  40. // https://vitejs.dev/config/server-options.html
  41. 'host': true,
  42. 'port': '3000',
  43. 'strictPort': true,
  44. 'open': '/editor/index.html'
  45. },
  46. 'plugins': [wasm(), glsl()]
  47. }
  48. })
  49. */