Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
chore: update examples to ^3.0.0-rc.10 and use global `defineNuxtCo…
Browse files Browse the repository at this point in the history
…nfig` (#7515)
  • Loading branch information
pi0 authored Sep 14, 2022
1 parent 94377b1 commit 5973df1
Show file tree
Hide file tree
Showing 69 changed files with 152 additions and 250 deletions.
4 changes: 0 additions & 4 deletions docs/content/1.getting-started/4.assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ In your `nuxt.config`
::code-group

```ts [SCSS]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
vite: {
css: {
Expand All @@ -86,8 +84,6 @@ export default defineNuxtConfig({
```

```ts [SASS]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
vite: {
css: {
Expand Down
1 change: 0 additions & 1 deletion docs/content/1.getting-started/9.testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ To test the modules we create, we could set up some Nuxt apps as fixtures and te

```ts
// nuxt.config.js
import { defineNuxtConfig } from 'nuxt'
import MyModule from '../../src'

export default defineNuxtConfig({
Expand Down
4 changes: 0 additions & 4 deletions docs/content/2.guide/1.concepts/7.esm.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ If you encounter these errors, the issue is almost certainly with the upstream l
In the meantime, you can tell Nuxt not to try to import these libraries by adding them to `build.transpile`:
```js
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
build: {
transpile: ['sample-library']
Expand All @@ -133,8 +131,6 @@ You may find that you _also_ need to add other packages that are being imported
In some cases, you may also need to manually alias the library to the CJS version, for example:
```js
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
alias: {
'sample-library': 'sample-library/dist/sample-library.cjs.js'
Expand Down
7 changes: 3 additions & 4 deletions docs/content/2.guide/2.directory-structure/1.components.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ If you are using `resolveComponent` to handle dynamic components, make sure not
Alternatively, though not recommended, you can register all your components globally, which will create async chunks for all your components and make them available throughout your application.

```diff
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
components: {
Expand Down Expand Up @@ -187,7 +186,7 @@ Make sure not to _nest_ `<ClientOnly>` components or other client-only component
If a component is meant to be rendered only client-side, you can add the `.client` suffix to your component.

```bash
| components/
| components/
--| Comments.client.vue
```

Expand All @@ -209,14 +208,14 @@ This feature only works with Nuxt auto-imports. Explicitly importing these compo
`.server` components are fallback components of `.client` components.

```bash
| components/
| components/
--| Comments.client.vue
--| Comments.server.vue
```

```html{}[pages/example.vue]
<template>
<div>
<div>
<!-- this component will render Comments.server server-side then Comments.client once mounted in client-side -->
<Comments />
</div>
Expand Down
2 changes: 0 additions & 2 deletions docs/content/2.guide/2.directory-structure/1.content.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ Install the `@nuxt/content` module in your project:
Then, add `@nuxt/content` to the `modules` section of `nuxt.config.ts`:

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
modules: [
'@nuxt/content'
Expand Down
2 changes: 0 additions & 2 deletions docs/content/2.guide/2.directory-structure/1.pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,6 @@ export default defineNuxtConfig({
You can enable hash history in SPA mode. In this mode, router uses a hash character (#) before the actual URL that is internally passed. When enabled, the **URL is never sent to the server** and **SSR is not supported**.

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
ssr: false,
router: {
Expand Down
4 changes: 0 additions & 4 deletions docs/content/2.guide/2.directory-structure/1.server.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ This is an advanced option. Custom config can affect production deployments, as
::

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
// https://nitro.unjs.io/config
nitro: {}
Expand Down Expand Up @@ -240,8 +238,6 @@ Nitro provides a cross-platform [storage layer](https://nitro.unjs.io/guide/intr
#### Example: Using Redis

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
nitro: {
storage: {
Expand Down
15 changes: 14 additions & 1 deletion docs/content/2.guide/2.directory-structure/3.nuxt.config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@ head.title: Nuxt Configuration file
Nuxt can be easily configured with a single `nuxt.config` file, which can have either a `.js`, `.ts` or `.mjs` extension.

```ts
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
// My Nuxt config
})
```


::alert
`defineNuxtConfig` helper is globally available without import.
::

You can explicitily import `defineNuxtConfig` from `nuxt/config` if you prefer:

```js
import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
// My Nuxt config
Expand Down
3 changes: 0 additions & 3 deletions docs/content/bridge/1.overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ Add the folder `.output` to the `.gitignore` file.

```ts [nuxt.config.js|ts]
import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
bridge: false // Temporarily disable bridge integration
})
Expand Down Expand Up @@ -222,7 +221,6 @@ You will also need to enable this feature explicitly in your `nuxt.config`:

```js
import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
bridge: {
meta: true
Expand All @@ -243,7 +241,6 @@ You can check [bridge/src/module.ts](https://github.com/nuxt/bridge/blob/main/sr

```ts [nuxt.config.js|ts]
import { defineNuxtConfig } from '@nuxt/bridge'

export default defineNuxtConfig({
bridge: {

Expand Down
4 changes: 0 additions & 4 deletions docs/content/migration/2.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
```

```ts [Nuxt 3]
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
// ...
})
Expand All @@ -50,8 +48,6 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
```

```ts [Nuxt 3]
import { defineNuxtConfig } from 'nuxt'
export default defineNuxtConfig({
hooks: {
'pages:extend' (routes) {
Expand Down
4 changes: 1 addition & 3 deletions docs/content/migration/8.runtime-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ When referencing these variables within your components, you will have to use th
::code-group

```ts [nuxt.config.ts]
import { defineNuxtConfig } from 'nuxt'

export default defineNuxtConfig({
runtimeConfig: {
// Private config that is only available on the server
Expand All @@ -38,7 +36,7 @@ export default defineNuxtConfig({
```vue [pages/index.vue]
<script setup>
const config = useRuntimeConfig()
// instead of process.env you will now access config.public.apiBase
console.log(config.public.apiBase)
</script>
Expand Down
Loading

0 comments on commit 5973df1

Please sign in to comment.