fix: replace code-preview.vue with TypeScript render function to fix SSR ERR_UNKNOWN_FILE_EXTENSION#44
Open
NullVoxPopuli-ai-agent wants to merge 1 commit into
Conversation
…d SSR extension error Node.js ESM cannot load .vue files natively. When vite-plugin-ember is in node_modules and VitePress runs its SSR build, the dynamic import of ../../src/vitepress/code-preview.vue in dist/vitepress/setup.js is resolved by Node.js directly, causing ERR_UNKNOWN_FILE_EXTENSION. Convert code-preview.vue to code-preview.ts using Vue's render function API so tsc compiles it to a plain .js file that Node.js ESM can load without Vite's transform pipeline. CSS is injected once into the document head on first mount instead of relying on SFC scoped styles. Fixes aklkv#39 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-fireplace
that referenced
this pull request
Apr 20, 2026
… build Applies the fix from aklkv/vite-plugin-ember#44 as a pnpm patch. The published dist/vitepress/setup.js dynamically imports code-preview.vue from source, which Node ESM cannot load during VitePress SSR. The patch replaces that import with a compiled .js render-function equivalent. Ref: aklkv/vite-plugin-ember#44
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-fireplace
that referenced
this pull request
Apr 20, 2026
… SSR build The published dist/vitepress/setup.js dynamically imports code-preview.vue from source, which Node ESM cannot load during VitePress SSR. This pnpm patch backports the fix from aklkv/vite-plugin-ember#44 so the docs build works today without waiting for a new release. Ref: aklkv/vite-plugin-ember#44
NullVoxPopuli-ai-agent
pushed a commit
to NullVoxPopuli-ai-agent/ember-fireplace
that referenced
this pull request
Apr 20, 2026
… SSR build The published dist/vitepress/setup.js dynamically imports code-preview.vue from source, which Node ESM cannot load during VitePress SSR. This pnpm patch backports the fix from aklkv/vite-plugin-ember#44 so the docs build works today without waiting for a new release. Ref: aklkv/vite-plugin-ember#44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #39
When a project uses
vite-plugin-emberand runsvitepress build, it fails with:Root cause:
dist/vitepress/setup.jscontains a dynamic import pointing back to the raw.vuesource:During VitePress's SSR build,
vite-plugin-emberis loaded fromnode_modulesand treated as external — its dynamic imports are resolved by Node.js native ESM, not Vite's transform pipeline. Node.js ESM does not recognise.vueas a valid module extension, so it throwsERR_UNKNOWN_FILE_EXTENSION.Fix
Convert
code-preview.vuetocode-preview.tsusing Vue'sdefineComponent+ render-function API:tsccompiles it todist/vitepress/code-preview.js— a plain JS file that Node.js ESM can load natively.setup.tsnow imports./code-preview.js(the compiled output) instead of../../src/vitepress/code-preview.vue.documentcheck, so SSR-safe)../components/CodePreviewpackage export is updated to point to the compileddist/vitepress/code-preview.js.Test plan
cd vite-plugin-ember && pnpm buildcompiles without errorsdist/vitepress/code-preview.jsexists and imports only.js/built modulesdist/vitepress/setup.jsimports./code-preview.js, not a.vuefilecd docs && pnpm build) completes without the extension error🤖 Generated with Claude Code