gornostay25 / svelte-adapter-bun

A SvelteKit adapter for Bun
MIT License
534 stars 33 forks source link

WebSocket currently not working #63

Closed timootten closed 2 months ago

timootten commented 3 months ago

Hey,

I recently started getting this error message when I start the builded project.

Error:

Fail: websocket handler error: 755 |     return handle(0);
756 |   }
757 |   function defaultAcceptWebsocket(request, upgrade) {
758 |     return upgrade(request);
759 |   }
760 |     const handleWebsocket = server.websocket();
                                                  ^
TypeError: server.websocket is not a function. (In 'server.websocket()', 'server.websocket' is undefined)
      at handler_default (C:\Users\timoo\Desktop\Projekte\Svelte-Stack\build\handler.js:760:45)
      at C:\Users\timoo\Desktop\Projekte\Svelte-Stack\build\index.js:14:48
timootten commented 2 months ago
import { paraglide } from '@inlang/paraglide-sveltekit/vite'
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { enhancedImages } from '@sveltejs/enhanced-img';
import { visualizer } from "rollup-plugin-visualizer";
import Inspect from 'vite-plugin-inspect';

export default defineConfig({
  plugins: [
    paraglide({ project: './project.inlang', outdir: './src/lib/paraglide' }),
    //Inspect(),
    enhancedImages(),
    sveltekit(),
    /*visualizer({
      emitFile: true,
      filename: "stats.html",
    }),*/
  ],
  build: {
    minify: true,
    /*rollupOptions: {
      output: {
        manualChunks(id: string) {
          console.log("CHUNK ID: ", id)
          if (id.includes('@melt-ui')) {
            return 'melt-ui'
          }
          if (id.includes('bits-ui')) {
            return `bits-ui`;
          }
        }
      }
    }*/
  },
  ssr: {
    noExternal: ['oslo']
  },
})

into

import { paraglide } from '@inlang/paraglide-sveltekit/vite'
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { enhancedImages } from '@sveltejs/enhanced-img';
import { visualizer } from "rollup-plugin-visualizer";
import Inspect from 'vite-plugin-inspect';

export default defineConfig({
  plugins: [
    paraglide({ project: './project.inlang', outdir: './src/lib/paraglide' }),
    //Inspect(),
    enhancedImages(),
    sveltekit(),
    /*visualizer({
      emitFile: true,
      filename: "stats.html",
    }),*/
  ],
  build: {
    /*rollupOptions: {
      output: {
        manualChunks(id: string) {
          console.log("CHUNK ID: ", id)
          if (id.includes('@melt-ui')) {
            return 'melt-ui'
          }
          if (id.includes('bits-ui')) {
            return `bits-ui`;
          }
        }
      }
    }*/
  },
  ssr: {
    noExternal: ['oslo']
  },
})