【发布时间】:2023-02-09 04:43:29
【问题描述】:
I created a Nuxt 3 project, my nuxt.config.ts looked like this :
export default defineNuxtConfig({
css: ['vuetify/lib/styles/main.sass'],
build: {
transpile: ['vuetify'],
},
vite: {
define: {
'process.env.DEBUG': false,
},
},
ssr: false
})
This works with that.
But i wanted to use .env variable so i read that i need to add :
env: {
baseUrl: process.env.BASE_URL
},
When i add it to the nuxt.config.ts, after the "ssr", i got the error :
"Object literal may only specify known properties, and 'env' does not exist in type 'NuxtConfig'"
So i read that most of people have a import of defineNuxtConfig so i wanted to add it to my file :
import { defineNuxtConfig } from "nuxt";
export default defineNuxtConfig({
css: ['vuetify/lib/styles/main.sass'],
build: {
transpile: ['vuetify'],
},
vite: {
define: {
'process.env.DEBUG': false,
},
},
env: {
baseUrl: process.env.BASE_URL
},
ssr: false
})
But now i have the error "Module '"nuxt"' has no exported member 'defineNuxtConfig'"
Any ideas ? :D
-
Did you manage to solve this? Having the same issue :)
标签: typescript nuxt.js nuxtjs3