Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/typegpu-docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import wasm from 'vite-plugin-wasm';
import basicSsl from '@vitejs/plugin-basic-ssl';
import rehypeMathJax from 'rehype-mathjax';
import remarkMath from 'remark-math';
import { relative, resolve } from 'pathe';

/**
* @template T
Expand All @@ -22,6 +23,7 @@ const stripFalsy = (items) =>
items.filter(/** @return {item is Exclude<T, boolean>} */ (item) => !!item);

const DEV = import.meta.env.DEV;
const EXAMPLES_DIR = resolve('./src/examples');

// https://astro.build/config
export default defineConfig({
Expand All @@ -41,6 +43,24 @@ export default defineConfig({
rehypePlugins: [rehypeMathJax],
},
vite: {
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.startsWith(EXAMPLES_DIR) && id.endsWith('.ts')) {
const relativePath = relative(EXAMPLES_DIR, id);
const [category, example] = relativePath.split('/');
if (example === undefined) {
return null;
}

return `example-${category}--${example}`;
}
},
onlyExplicitManualChunks: true,
},
},
},
define: {
// Required for '@rolldown/browser' to work.
'process.env.NODE_DEBUG_NATIVE': '""',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"sharp"
],
"overrides": {
"rollup": "4.34.8",
"rollup": "^4.55.1",
"three": "catalog:example"
}
}
Expand Down
Loading