Closed paraboul closed 2 years ago
It worked with extra plugin mutating config.ssr.external
tho. repro link
It worked with extra plugin mutating
config.ssr.external
tho. repro link
Indeed, thanks 👍. This feels a bit hackish though. Is there any particular reason that Vue won't be externalised despite the ssr.noExternal
rule?
I think Vite checks external
first then noExternal
, not sure how this should be properly handled?
I think this part is affecting this. Since vite 3 externalizes everything, maybe this should be removed. https://github.com/vitejs/vite/blob/a2b313126abdf2e0652502cbcd4b94353c37f91a/packages/plugin-vue/src/index.ts#L126-L128
Describe the bug
I'm migrating a project from vite 2 to 3, and just facing a little issue with SSR externals.
It vite 2, I was just using something like
noExternal: /./
to make sure nothing is externalised, which worked well.In Vite 3, it seems that
vue
and@vue/server-renderer
are not externalised (the generated output imports vue methods from the vue package). All others deps are bundled into the mjs output.I tried to set
ssr.noExternal
to true, but then I got various error likeCannot bundle Node.js built-in "http" imported from "node_modules/axios/lib/adapters/http.js". Consider disabling ssr.noExternal or remove the built-in dependency
I also tried to manually exclude 'vue' package with something like noExternal: [/./, 'vue'] with no luck
Another weird thing is that the import output looks broken too. I tried to add
vue
as a deps as a workaround but got thisReproduction
https://stackblitz.com/edit/vitejs-vite-7k3ode?file=dist/server/entry-server.js
System Info
Used Package Manager
yarn
Logs
No response
Validations