You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it is now with v3.0.0.alpha.12, Vuetify 3 can't be used with Nuxt 3. My attempt at getting them to work together was a normally configured Nuxt 3 project and had the following code in vuetify.js within the plugins directory:
So the problem is definitely a result of Vuetify not having access to process.env. However, defining DEBUG and NODE_ENV within the env field of defineNuxtConfig did not work, which is normally how process.env is accessed from within your application. Directly editing the Vuetify file that caused the errors from within node_modules didn't work either.
The only solution that worked was removing the nuxt3 devdependency and reinstalling it as a normal dependency, which made the error go away temporarily. But after uploading my code to a GitHub repository and cloning it into a different directory, the same error would show up after running the application and opening it up in my browser.
Proposed solution
Probably due to webpack or possibly Babel, Vuetify does not have access to process.env, even when you use the env field within defineNuxtConfig. I am not sure what the best solution to this would be. You could add an environment variables field to VuetifyOptions within framework.ts, and then using this set process.env.DEBUG and process.env.NODE_ENV. You could also check to see if process.env exists within util/globals.ts before setting IS_DEBUG and IS_PROD, but then these values would not always be correct; this would just make the errors go away. The first solution is probably better, but I don't know if the Vuetify contributors would want to add another field to Vuetify options just for Nuxt users.
The text was updated successfully, but these errors were encountered:
Problem to solve
As it is now with v3.0.0.alpha.12, Vuetify 3 can't be used with Nuxt 3. My attempt at getting them to work together was a normally configured Nuxt 3 project and had the following code in vuetify.js within the plugins directory:
My nuxt.config.js file looked like:
But after running the application with
npx nuxi dev
and opening it up in my browser, I got the following error message in the console:The file that caused the error:
So the problem is definitely a result of Vuetify not having access to process.env. However, defining DEBUG and NODE_ENV within the env field of defineNuxtConfig did not work, which is normally how process.env is accessed from within your application. Directly editing the Vuetify file that caused the errors from within node_modules didn't work either.
The only solution that worked was removing the nuxt3 devdependency and reinstalling it as a normal dependency, which made the error go away temporarily. But after uploading my code to a GitHub repository and cloning it into a different directory, the same error would show up after running the application and opening it up in my browser.
Proposed solution
Probably due to webpack or possibly Babel, Vuetify does not have access to process.env, even when you use the env field within defineNuxtConfig. I am not sure what the best solution to this would be. You could add an environment variables field to VuetifyOptions within framework.ts, and then using this set process.env.DEBUG and process.env.NODE_ENV. You could also check to see if process.env exists within util/globals.ts before setting IS_DEBUG and IS_PROD, but then these values would not always be correct; this would just make the errors go away. The first solution is probably better, but I don't know if the Vuetify contributors would want to add another field to Vuetify options just for Nuxt users.
The text was updated successfully, but these errors were encountered: