import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';

export default defineConfig({
  plugins: [svelte()],
  build: {
    lib: {
      entry: 'src/index.ts',
      formats: ['es'],
      fileName: 'index',
    },
    rollupOptions: {
      external: ['svelte', '@babylonjs/core', '@babylonjs/loaders'],
      output: {
        globals: {
          svelte: 'svelte',
          '@babylonjs/core': 'BABYLON',
          '@babylonjs/loaders': 'BABYLON',
        },
      },
    },
    sourcemap: true,
  },
});
