import svelte from 'rollup-plugin-svelte'; import commonjs from '@rollup/plugin-commonjs'; import resolve from '@rollup/plugin-node-resolve'; import { terser } from 'rollup-plugin-terser'; import sveltePreprocess from 'svelte-preprocess'; import typescript from '@rollup/plugin-typescript'; import css from 'rollup-plugin-css-only'; import includePaths from 'rollup-plugin-includepaths'; import glslify from 'rollup-plugin-glslify'; const production = !process.env.ROLLUP_WATCH; export default [ { input: 'src/ai.ts', output: { sourcemap: true, format: 'iife', name: 'app', file: 'public/build/ai-worker.js' }, plugins: [ resolve({ browser: true, dedupe: ['svelte'] }), commonjs(), typescript({ sourceMap: !production, inlineSources: !production }), // If we're building for production (npm run build // instead of npm run dev), minify production && terser() ] }, { input: 'src/main.ts', output: { sourcemap: true, format: 'iife', name: 'app', file: 'public/build/bundle.js' }, plugins: [ includePaths({ paths: ["src"], extensions: [".ts", ".svelte"] }), svelte({ preprocess: sveltePreprocess({ sourceMap: !production }), compilerOptions: { // enable run-time checks when not in production dev: !production } }), // we'll extract any component CSS out into // a separate file - better for performance css({ output: 'bundle.css' }), glslify(), // If you have external dependencies installed from // npm, you'll most likely need these plugins. In // some cases you'll need additional configuration - // consult the documentation for details: // https://github.com/rollup/plugins/tree/master/packages/commonjs resolve({ browser: true, dedupe: ['svelte'] }), commonjs(), typescript({ sourceMap: !production, inlineSources: !production }), // If we're building for production (npm run build // instead of npm run dev), minify production && terser() ], watch: { clearScreen: false, chokidar: { followSymlinks: true } } }];