Skip to content

Commit affafc7

Browse files
committed
Hotfix for playground CDN load in docs
1 parent 48ff8eb commit affafc7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/snippets/Playground.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ export const Playground = ({
151151
try {
152152
loadCSS(isDarkMode ? CDN_URLS.prismCSSDark : CDN_URLS.prismCSSLight, "prism");
153153
// numpy-ts v1.3+ ships an ESM browser bundle — load via dynamic import.
154-
const npModule = await import(/* webpackIgnore: true */ /* @vite-ignore */ CDN_URLS.numpyTs);
154+
// Wrapped in `new Function` so Mintlify's MDX compiler doesn't
155+
// misparse the bare `import(...)` token as a static import statement
156+
// (which isn't allowed inside a generated function body).
157+
const dynamicImport = new Function("url", "return import(url)");
158+
const npModule = await dynamicImport(CDN_URLS.numpyTs);
155159
npRef.current = npModule.default ?? npModule;
156160
await loadScript(CDN_URLS.prismCore);
157161
await loadScript(CDN_URLS.prismTS);

0 commit comments

Comments
 (0)