🎥 Make videos programmatically with React
import {build} from 'bun';
if (process.env.NODE_ENV !== 'production') {
throw new Error('This script must be run using NODE_ENV=production');
}
const output = await build({
entrypoints: ['src/index.ts'],
naming: '[name].mjs',
target: 'node',
external: ['sass', 'sass-loader', 'css-loader', 'style-loader'],
});
if (!output.success) {
console.log(output.logs);
throw new Error('Build failed');
}
const [file] = output.outputs;
const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
export {};