mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
refactor: fix typo and code improvements (#5344)
This commit is contained in:
parent
eafd92c457
commit
139fc11c5a
@ -20,7 +20,7 @@ Once you have installed the modules you can then add them to your `nuxt.config.t
|
||||
```ts{}[nuxt.config.ts]
|
||||
export default defineNuxtConfig({
|
||||
modules: [
|
||||
// Using package name (recommanded usage)
|
||||
// Using package name (recommended usage)
|
||||
'@nuxtjs/example',
|
||||
|
||||
// Load a local module
|
||||
|
@ -196,7 +196,7 @@ export default (req, res) => {
|
||||
```
|
||||
|
||||
::alert{type=warning}
|
||||
Legacy support is possible using [unjs/h3](https://github.com/unjs/h3) but it adviced to avoid legacy handlers as much as you can.
|
||||
Legacy support is possible using [unjs/h3](https://github.com/unjs/h3) but it advised to avoid legacy handlers as much as you can.
|
||||
::
|
||||
|
||||
```ts [/server/middleware/legacy.ts]
|
||||
|
@ -23,7 +23,7 @@ Nuxt provides the `<NuxtErrorBoundary>` component to handle client-side errors h
|
||||
<NuxtErrorBoundary>
|
||||
<!-- ... -->
|
||||
<template #error="{ error }">
|
||||
<p>An error occured: {{ error }}</p>
|
||||
<p>An error occurred: {{ error }}</p>
|
||||
</template>
|
||||
</NuxtErrorBoundary>
|
||||
</template>
|
||||
|
@ -8,6 +8,6 @@ The `init` command initializes a fresh Nuxt project.
|
||||
|
||||
Option | Default | Description
|
||||
-------------------------|-----------------|------------------
|
||||
`--verbose, -v` | `false` | Log informations about the installation process.
|
||||
`--verbose, -v` | `false` | Log information about the installation process.
|
||||
`--template, -t` | `nuxt/starter#v3` | Specify a Git repository to use as a template.
|
||||
`dir` | `nuxt-app` | Name of the install directory.
|
||||
|
@ -22,7 +22,7 @@ export async function checkNuxtCompatibility (constraints: NuxtCompatibility, nu
|
||||
|
||||
// Bridge compatibility check
|
||||
if (isNuxt2(nuxt)) {
|
||||
const bridgeRequirement = constraints?.bridge
|
||||
const bridgeRequirement = constraints.bridge
|
||||
const hasBridge = !!(nuxt.options as any).bridge
|
||||
if (bridgeRequirement === true && !hasBridge) {
|
||||
issues.push({
|
||||
@ -86,7 +86,7 @@ export function isNuxt3 (nuxt: Nuxt = useNuxt()) {
|
||||
export function getNuxtVersion (nuxt: Nuxt | any = useNuxt() /* TODO: LegacyNuxt */) {
|
||||
const version = (nuxt?._version || nuxt?.version || nuxt?.constructor?.version || '').replace(/^v/g, '')
|
||||
if (!version) {
|
||||
throw new Error('Cannot determine nuxt version! Is currect instance passed?')
|
||||
throw new Error('Cannot determine nuxt version! Is current instance passed?')
|
||||
}
|
||||
return version
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: Mo
|
||||
// @ts-ignore TODO: Remove non-meta fallbacks in RC
|
||||
definition.meta.name = definition.meta.name || definition.name
|
||||
// @ts-ignore
|
||||
definition.meta.configKey = definition.meta.configKey || definition.configKey || definition.meta.name
|
||||
definition.meta.configKey = definition.configKey || definition.meta.name
|
||||
}
|
||||
|
||||
// Resolves module options from inline options, [configKey] in nuxt.config, defaults and schema
|
||||
|
@ -119,7 +119,7 @@ async function initNuxt (nuxt: Nuxt) {
|
||||
|
||||
await nuxt.callHook('modules:done', { nuxt } as ModuleContainer)
|
||||
|
||||
await addModuleTranspiles()
|
||||
addModuleTranspiles()
|
||||
|
||||
// Init nitro
|
||||
await initNitro(nuxt)
|
||||
|
@ -50,8 +50,8 @@ function getManifest (server: ViteDevServer) {
|
||||
function createViteNodeMiddleware (ctx: ViteBuildContext) {
|
||||
const app = createApp()
|
||||
|
||||
app.use('/manifest', defineEventHandler(async () => {
|
||||
const manifest = await getManifest(ctx.ssrServer)
|
||||
app.use('/manifest', defineEventHandler(() => {
|
||||
const manifest = getManifest(ctx.ssrServer)
|
||||
return manifest
|
||||
}))
|
||||
|
||||
|
@ -60,7 +60,7 @@ export const getPostcssConfig = (nuxt: Nuxt) => {
|
||||
return false
|
||||
}
|
||||
|
||||
const configFile = nuxt.options.postcss?.config
|
||||
const configFile = nuxt.options.postcss.config
|
||||
if (configFile) {
|
||||
return {
|
||||
postcssOptions: {
|
||||
|
@ -18,7 +18,7 @@ import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './ut
|
||||
// const plugins: string[] = []
|
||||
|
||||
export async function bundle (nuxt: Nuxt) {
|
||||
await registerVirtualModules()
|
||||
registerVirtualModules()
|
||||
|
||||
const webpackConfigs = [client, ...nuxt.options.ssr ? [server] : []].map((preset) => {
|
||||
const ctx = createWebpackConfigContext(nuxt)
|
||||
|
Loading…
Reference in New Issue
Block a user