Skip to content

SyntaxError: Named export 'xxx' not found. The requested module 'xxx.js' is a CommonJS module, #1149

Discussion options

You must be logged in to vote

I'd use https://github.com/cyco130/vite-plugin-cjs-interop to fix the issue. Alternatively, you can add the problematic npm package to ssr.noExternal.

Also, vike-vue has an ssr: boolean flag which allows you to seamlessly disable SSR. This means you can disable SSR for your map pages while using SSR for your other pages. You can use Bati to scaffold a vike-vue app.

If you want SSR for the outer part of your map pages, you can wrap your map in a <ClientOnly> component so that it's imported only on the client-side.

Let me know how it goes.

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@brillout
Comment options

@brillout
Comment options

@EralChen
Comment options

@brillout
Comment options

Answer selected by EralChen
@EralChen
Comment options

@EralChen
Comment options

@brillout
Comment options

@brillout
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants