-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug Report][3.0.0-alpha.9][SSR] Cannot find module 'vuetify/lib/components' #13936
Comments
same thing with vite-ssg, looks like it compiles |
There's an example here although I don't see any component import: https://github.com/vuetifyjs/vuetify/tree/next/packages/vuetify/dev According to a conversation on Discord, I think @KaelWD got |
That was for the dev environment which imports from src. To get prod working with vite you might have to change the import to |
cc @cprcrack |
You could also try adding vuetify to |
Can confirm changing to |
Why would I want to do this? I don't see why Vite should transpile Vuetify? (Thanks for your lovely work btw.) |
Adding
Not only for |
I updated the reproduction https://github.com/brillout/vuetify3-ssr |
Adding |
I also get:
|
Looks like we get the same thing in our SSR environment too. This was probably broken by 3520db1 |
I am getting the same error when I try to setup vuetify and pass it to wrapper in my unit test code. But, with yarn serve, I do not have such problem. The same code works perfectly. I should note that adding vuetify version: // StatusBtn.spec.ts
import { shallowMount } from "@vue/test-utils";
import { createI18n } from "vue-i18n";
import { store, key } from "@/store";
import { createVuetify } from "vuetify";
import * as components from "vuetify/lib/components";
import * as directives from "vuetify/lib/directives";
import StatusBtn from "@/components/commons/StatusBtn.vue";
describe("StatusBtn.vue", () => {
it("report disconnected status with the initial state", () => {
const i18n = createI18n({ locale: "en" });
const vuetify = createVuetify({components, directives});
const wrapper = shallowMount(StatusBtn, {
global: {
plugins: [i18n, vuetify, [store, key]],
},
});
expect(wrapper.text()).toMatch("status: disconnected");
});
}); I get:
When
|
I have this working for me on the client side. page/_default/vuetify.js -> `import '@mdi/font/css/materialdesignicons.css' export default createVuetify({ components, directives }) vite.config.js -> ( this is a little specific to my needs - ie: runtimeCompiler and vue alias.
@vue/cli 4.5.13 The fact that a browser based button is shown then styled is a little worry but no related. I'll try the above with a vanilla vite-ssr-plugin project and let you know. |
Alpha 11 now uses package exports, so you should be able to import from |
@KaelWD I can confirm. But now I get:
Repro: https://github.com/brillout/vite-plugin-ssr-vuetify/tree/updated-deps. Note that the repro does use ESM ( It's a Vite problem and there is a proposal to make Vite better support ESM dependencies. @KaelWD I can keep you in the loop, if you want. |
Environment
Vuetify Version: 3.0.0-alpha.9
Vue Version: 3.0.11
Browsers: Chrome 91.0.4472.102
OS: Chromium OS 13904.55.0
Steps to reproduce
Expected Behavior
No error is thrown.
Actual Behavior
Error is thrown:
Reproduction Link
https://github.com/brillout/vuetify3-ssr
Other comments
Hi, is vuetify supposed to work with SSR and Vite?
Trying to use Vuetify + Vite + SSR leads to an error where the npm package
resolve
cannot findvuetify/lib/components
.The text was updated successfully, but these errors were encountered: