Skip to content

Commit 32d5821

Browse files
committed
fix: interesting workaround
1 parent b394459 commit 32d5821

File tree

7 files changed

+18
-97
lines changed

7 files changed

+18
-97
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package-lock.json
1010
# Next.js Build Output
1111
.next
1212
build
13+
next-env.d.ts
1314

1415
# Test Runner
1516
junit.xml

apps/site/app/global-error.tsx

Lines changed: 0 additions & 37 deletions
This file was deleted.

apps/site/app/global-not-found.tsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

apps/site/mdx/plugins.mjs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ import remarkTableTitles from '../util/table';
1515
// Reference: https://github.com/nodejs/nodejs.org/pull/7896#issuecomment-3009480615
1616
const OPEN_NEXT_CLOUDFLARE = 'Cloudflare' in global;
1717

18+
// Shiki **must** be a singleton, otherwise multiple instances drastically reduce performance
19+
const singletonShiki = rehypeShikiji({
20+
// We use the faster WASM engine on the server instead of the web-optimized version.
21+
//
22+
// Currently we fall back to the JavaScript RegEx engine
23+
// on Cloudflare workers because `shiki/wasm` requires loading via
24+
// `WebAssembly.instantiate` with custom imports, which Cloudflare doesn't support
25+
// for security reasons.
26+
wasm: !OPEN_NEXT_CLOUDFLARE,
27+
28+
// TODO(@avivkeller): Find a way to enable Twoslash w/ a VFS on Cloudflare
29+
twoslash: !OPEN_NEXT_CLOUDFLARE,
30+
});
31+
1832
/**
1933
* Provides all our Rehype Plugins that are used within MDX
2034
*/
@@ -25,21 +39,7 @@ export const rehypePlugins = [
2539
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
2640
// Transforms sequential code elements into code tabs and
2741
// adds our syntax highlighter (Shikiji) to Codeboxes
28-
[
29-
rehypeShikiji,
30-
{
31-
// We use the faster WASM engine on the server instead of the web-optimized version.
32-
//
33-
// Currently we fall back to the JavaScript RegEx engine
34-
// on Cloudflare workers because `shiki/wasm` requires loading via
35-
// `WebAssembly.instantiate` with custom imports, which Cloudflare doesn't support
36-
// for security reasons.
37-
wasm: !OPEN_NEXT_CLOUDFLARE,
38-
39-
// TODO(@avivkeller): Find a way to enable Twoslash w/ a VFS on Cloudflare
40-
twoslash: !OPEN_NEXT_CLOUDFLARE,
41-
},
42-
],
42+
() => singletonShiki,
4343
];
4444

4545
/**

apps/site/next.config.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ const nextConfig = {
7878
typedRoutes: true,
7979
// Experimental Flags
8080
experimental: {
81-
// Enables global not-found without intl.
82-
globalNotFound: true,
8381
// Ensure that server-side code is also minified
8482
serverMinification: true,
8583
// Use Workers and Threads for webpack compilation

apps/site/pages/404.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default () => null;

apps/site/pages/500.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default () => null;

0 commit comments

Comments
 (0)