You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

esbuild.config.mjs 871B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* eslint-disable no-undef */
  2. import fs from 'fs'
  3. import esbuild from 'esbuild'
  4. import serve, { error, log } from 'create-serve'
  5. if (!fs.existsSync('./dist')) {
  6. fs.mkdirSync('./dist')
  7. }
  8. fs.copyFile('./src/index.html', './dist/index.html', (err) => {
  9. if (err) throw err
  10. })
  11. esbuild
  12. .build({
  13. entryPoints: ['src/index.tsx'],
  14. outfile: 'dist/index.js',
  15. minify: false,
  16. bundle: true,
  17. sourcemap: true,
  18. incremental: true,
  19. format: 'esm',
  20. target: 'esnext',
  21. define: {
  22. 'process.env.LIVEBLOCKS_PUBLIC_API_KEY': process.env.LIVEBLOCKS_PUBLIC_API_KEY,
  23. 'process.env.NODE_ENV': '"development"',
  24. },
  25. watch: {
  26. onRebuild(err) {
  27. serve.update()
  28. err ? error('❌ Failed') : log('✅ Updated')
  29. },
  30. },
  31. })
  32. .catch(() => process.exit(1))
  33. serve.start({
  34. port: 5000,
  35. root: './dist',
  36. live: true,
  37. })