`@comark/nuxt`: Bad character escape sequence, expected 4 hex characters (Note that you need plugins to import files that are not JavaScript)
Environment
| Operating system | Windows 11.0.26200 |
| CPU | Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz (8 cores) |
| Node.js version | v24.15.0 |
| nuxt/cli version | 3.35.2 |
| Package manager | [email protected] |
| Nuxt version | 4.4.6 |
| Nitro version | 2.13.4 |
| Builder | [email protected] |
| Config | app, compatibilityDate, css, devtools, icon, modules, nitro, routeRules, site, ssr, ui, vite |
| Modules | @nuxt/[email protected], @pinia/[email protected], pinia-plugin-persistedstate/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @comark/[email protected] |
Comark Version
v0.3.1
Reproduction
D:\Projects\project>npx nuxt generate
┌ Building Nuxt for production...
│
● Nuxt 4.4.6 (with Nitro 2.13.4, Vite 7.3.3 and Vue 3.5.35)
ℹ No dynamic sources detected. Consider enabling zeroRuntime to reduce server bundle size. See https://nuxtseo.com/sitemap/guides/zero-runtime @nuxtjs/sitemap 9:37:21 am
ℹ Nuxt Icon server bundle mode is set to local 9:37:22 am
│
● Nitro preset: static
✔ Nuxt Icon loaded local collection localIcons with 12 icons 9:37:22 am
ℹ Nuxt Icon client bundle consist of 12 icons with 4.58KB(uncompressed) in size 9:37:22 am
ℹ Building client... 9:37:24 am
ℹ vite v7.3.3 building client environment for production... 9:37:24 am
[9:37:24 am] WARN [plugin nuxt:module-preload-polyfill] Sourcemap is likely to be incorrect: a plugin (nuxt:module-preload-polyfill) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
[9:37:24 am] WARN [plugin @tailwindcss/vite:generate:build] Sourcemap is likely to be incorrect: a plugin (@tailwindcss/vite:generate:build) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
ℹ ✓ 169 modules transformed. 9:37:25 am
ERROR ✗ Build failed in 879ms 9:37:25 am
│
■ Nuxt build error: RollupError: node_modules/.pnpm/@[email protected]_@internation_ade17b7dcbc8b72ab9985a79d5266c9b/node_modules/@nuxt/ui/dist/runtime/components/prose/Callout.vue (2:167): Bad character escape sequence, expected 4 hex characters (Note that you need plugins to import files that are not JavaScript)
│ file: D:/Projects/project/node_modules/.pnpm/@[email protected]_@internation_ade17b7dcbc8b72ab9985a79d5266c9b/node_modules/@nuxt/ui/dist/runtime/components/prose/Callout.vue:2:167
│
│ 1: <script>
│ 2: import theme from "#build/ui/prose/callout";
│ ^
│ 3: </script>
│
Description
Additional context
No response
Logs
https://github.com/comarkdown/comark/issues/191#issuecomment-4508739385 - I tried this, but didn't help.
Hey @abhishek-junghare Do you mind providing a simple repo so I can clone and reproduce the issue?
This is fixed by #207, released in @comark/[email protected] — but @comark/nuxt@^0.3.1 resolves its @comark/vue dependency to 0.3.1, which predates the fix, so a regular lockfile update never picks it up. Upgrading explicitly resolves the build error:
pnpm add @comark/nuxt@^0.4.0
Confirmed on Windows 11, Nuxt 4.4.6, @nuxt/ui 4.8.2: same Bad character escape sequence error in prose/Callout.vue / prose/Badge.vue on 0.3.1, clean production build after upgrading to 0.4.0 (no other changes).
For context, the failure mechanism: the viteComarkSlot node transform injects runtimeDir as an import path into compiled Vue template code for any component containing <slot mdc-unwrap> (which is exactly @nuxt/ui's prose components). On Windows that path contains backslashes, so segments like \utils / \node_modules become \u... / \n escape sequences in the generated import specifier, which Rollup rejects during the client production build. Dev mode tolerates it, which is why it only shows up in nuxt build. 0.4.0 normalizes the injected path via toImportPath().
Thanks for the report, and @caybokotze for confirming the fix.
This is the Windows backslash import-path bug tracked in #191. It was fixed in #207 and shipped in @comark/[email protected]. @comark/[email protected] still resolves to the older @comark/vue, so the build error comes back until you upgrade.
Please upgrade to the latest @comark/nuxt (pnpm add @comark/nuxt@latest). If the build still fails on a current version, reopen this issue with a minimal repro and we'll take another look.