Skip to content

Commit

Permalink
Vite config
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Sep 12, 2023
1 parent be952ca commit 0072349
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions/configure-pages@v3

- name: Build Website
run: npm run build
run: npm run build -- --base /bench/

- name: Upload Artifact
uses: actions/upload-pages-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bench",
"type": "module",
"scripts": {
"lint": "eslint cases",
"lint": "eslint vite.config.js cases",
"typecheck": "tsc --pretty",
"test": "npm run lint && npm run typecheck",
"start": "vite dev",
Expand Down
24 changes: 24 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {defineConfig} from 'vite';
import {existsSync, readdirSync} from 'fs';
import {join, resolve} from 'path';

const casesDir = resolve(__dirname, 'cases');

const input = {
main: resolve(__dirname, 'index.html'),
};

for (const name of readdirSync(casesDir)) {
const candidate = join(casesDir, name, 'index.html');
if (existsSync(candidate)) {
input[name] = candidate;
}
}

export default defineConfig({
build: {
rollupOptions: {
input,
},
},
});

0 comments on commit 0072349

Please sign in to comment.