pi0 / nuxt-shiki

🎨 Nuxt + Shiki syntax highlighter
80 stars 2 forks source link

plugin inject onig.wasm warning #29

Open leosin opened 7 months ago

leosin commented 7 months ago

[21:01:24] WARN [plugin inject] ../../node_modules/.pnpm/shiki@1.3.0/node_modules/shiki/dist/onig.wasm: rollup-plugin-inject: failed to parse /Users/abc/Projects/xxx/node_modules/.pnpm/shiki@1.3.0/node_modules/shiki/dist/onig.wasm. Consider restricting the plugin to particular files via options.include

Please help take a look, I'm not sure if this warning comes from the current module, or the upstream shiki plugin.

I remember it was still fine in nuxt version 3.10.3 and shiki 1.2.4

I'm currently using pnpm workspace, and nuxt 3.11.2

mateusznarowski commented 7 months ago

I have also been struggling with this warning for a couple of days, at the moment I have discovered that the warning only appears when I have added one of these 3 modules

nuxt-delay-hydration
nuxt-simple-robots
nuxt-schema-org

These 3 modules are from https://github.com/harlan-zw so it appears that something is interfering between them, warning does not appear on version 0.2.1 only on version 0.3.0

After checking for changes between versions, I see that in this issue https://github.com/pi0/nuxt-shiki/issues/23, option with setting nitro.experimental.wasm: true removes the warning

export default defineNuxtConfig({
  nitro: {
    experimental: {
      wasm: true,
    },
  },
})
leopoldkristjansson commented 3 weeks ago

I am using Nuxt ^3.13.2 and nuxt-shiki ^0.3.0. When I run npm run build I get the following error:

ERROR Nuxt Build Error: [vite:wasm-fallback] Could not load /Users/username/....../node_modules/shiki/dist/onig.wasm (imported by node_modules/nuxt-shiki/dist/runtime/shiki.mjs): "ESM integration proposal for Wasm" is not supported currently. Use vite-plugin-wasm or other community plugins to handle this. Alternatively, you can use .wasm?init or .wasm?url. See https://vite.dev/guide/features.html#webassembly for more details.

 ERROR  x Build failed in 1.02s                                                                                                                                                                                                                                             

ERROR  Nuxt Build Error: [vite:wasm-fallback] Could not load /Users/username/....../node_modules/shiki/dist/onig.wasm (imported by node_modules/nuxt-shiki/dist/runtime/shiki.mjs): "ESM integration proposal for Wasm" is not supported currently. Use vite-plugin-wasm or other community plugins to handle this. Alternatively, you can use .wasm?init or .wasm?url. See https://vite.dev/guide/features.html#webassembly for more details.

  at Object.load (node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:47590:13)
  at Object.handler (node_modules/vite/dist/node/chunks/dep-BWSbWtLw.js:65668:15)
  at node_modules/rollup/dist/es/shared/node-entry.js:20760:40
  at async PluginDriver.hookFirstAndGetPlugin (node_modules/rollup/dist/es/shared/node-entry.js:20660:28)
  at async node_modules/rollup/dist/es/shared/node-entry.js:19780:33
  at async Queue.work (node_modules/rollup/dist/es/shared/node-entry.js:20870:32)

It works when I revert to Nuxt ^3.12.3"

Besufikad17 commented 3 weeks ago

#41