32 lines
1006 B
JavaScript
32 lines
1006 B
JavaScript
import { defineConfig } from 'vite';
|
|
import { copyFileSync } from 'node:fs';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { ortMemoryPlugin } from './build/ort-memory.js';
|
|
|
|
export default defineConfig({
|
|
base: '/play/microduck/',
|
|
plugins: [ortMemoryPlugin(), {
|
|
name: 'preserve-upstream-notices',
|
|
closeBundle() {
|
|
for (const name of ['LICENSE', 'NOTICE', 'UPSTREAM.md']) copyFileSync(
|
|
fileURLToPath(new URL(name, import.meta.url)),
|
|
fileURLToPath(new URL(`../play/microduck/${name}`, import.meta.url)),
|
|
);
|
|
},
|
|
}],
|
|
server: { port: 5179 },
|
|
build: {
|
|
outDir: '../play/microduck',
|
|
emptyOutDir: true,
|
|
assetsDir: 'bundle',
|
|
chunkSizeWarningLimit: 1500,
|
|
rolldownOptions: {
|
|
output: {
|
|
// Standalone ORT ESM must retain a JS MIME type on static hosts.
|
|
assetFileNames: (asset) => asset.names.some((name) => name.endsWith('.mjs'))
|
|
? 'bundle/[name]-[hash].js' : 'bundle/[name]-[hash][extname]',
|
|
},
|
|
},
|
|
},
|
|
});
|