docs: replace @nuxt/kit example with node built-ins (#19873)

This commit is contained in:
warflash 2023-03-23 01:40:59 +01:00 committed by GitHub
parent dc5982d9e0
commit 284199979f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -160,13 +160,14 @@ When importing using aliases (such as `~/` and `@/`) in a layer components and c
Also when using relative paths in `nuxt.config` file of a layer, (with exception of nested `extends`) they are resolved relative to user's project instead of the layer. As a workaround, use full resolved paths in `nuxt.config`:
```js [nuxt.config.ts]
import { createResolver } from '@nuxt/kit'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
const { resolve } = createResolver(import.meta.url)
const currentDir = dirname(fileURLToPath(import.meta.url))
export default defineNuxtConfig({
css: [
resolve('./assets/main.css')
join(currentDir, './assets/main.css')
]
})
```