fix vite config
This commit is contained in:
parent
2fccf42c9e
commit
3623702b79
|
|
@ -89,7 +89,6 @@
|
|||
});
|
||||
|
||||
document.addEventListener('click', (event) => {
|
||||
console.log(event.target);
|
||||
if (event.target === document.body || event.target === projector) {
|
||||
projector.project();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,18 +4,16 @@ import { defineConfig, IndexHtmlTransformContext, Plugin } from 'vite';
|
|||
|
||||
const demoDir = resolve(__dirname, 'demo');
|
||||
|
||||
const files: string[] = readdirSync(demoDir).filter((file) => file.endsWith('.html'));
|
||||
const input: Record<string, string> = files.reduce((acc, file) => {
|
||||
acc[file.replace('.html', '')] = resolve(demoDir, file);
|
||||
return acc;
|
||||
}, {} as Record<string, string>);
|
||||
function getFiles() {
|
||||
return readdirSync(demoDir).filter((file) => file.endsWith('.html'));
|
||||
}
|
||||
|
||||
const linkGenerator = (): Plugin => {
|
||||
return {
|
||||
name: 'link-generator',
|
||||
transformIndexHtml(html: string, ctx: IndexHtmlTransformContext) {
|
||||
if (!ctx.filename.endsWith('index.html')) return;
|
||||
|
||||
const files = getFiles();
|
||||
// First, handle ungrouped files
|
||||
const ungroupedFiles = files.filter(
|
||||
(file) => !file.includes('index') && !file.startsWith('_') && !file.match(/^\[([^\]]+)\]/)
|
||||
|
|
@ -70,7 +68,12 @@ export default defineConfig({
|
|||
plugins: [linkGenerator()],
|
||||
build: {
|
||||
target: 'esnext',
|
||||
rollupOptions: { input },
|
||||
rollupOptions: {
|
||||
input: getFiles().reduce((acc, file) => {
|
||||
acc[file.replace('.html', '')] = resolve(demoDir, file);
|
||||
return acc;
|
||||
}, {} as Record<string, string>),
|
||||
},
|
||||
modulePreload: {
|
||||
polyfill: false,
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue