mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
feat(nuxt3): expose /app
export paths (#3323)
This commit is contained in:
parent
22c3e33c1e
commit
70542a3af7
@ -10,6 +10,8 @@ export function setupAppBridge (_options: any) {
|
|||||||
|
|
||||||
// Setup aliases
|
// Setup aliases
|
||||||
nuxt.options.alias['#app'] = resolve(distDir, 'runtime/index.mjs')
|
nuxt.options.alias['#app'] = resolve(distDir, 'runtime/index.mjs')
|
||||||
|
nuxt.options.alias['nuxt3/app'] = nuxt.options.alias['#app']
|
||||||
|
nuxt.options.alias['nuxt/app'] = nuxt.options.alias['#app']
|
||||||
nuxt.options.alias['#build'] = nuxt.options.buildDir
|
nuxt.options.alias['#build'] = nuxt.options.buildDir
|
||||||
|
|
||||||
// Mock `bundleBuilder.build` to support `nuxi prepare`
|
// Mock `bundleBuilder.build` to support `nuxi prepare`
|
||||||
|
1
packages/nuxt3/app.d.ts
vendored
Normal file
1
packages/nuxt3/app.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './dist/app'
|
@ -10,7 +10,18 @@
|
|||||||
"nuxi": "./bin/nuxt.mjs",
|
"nuxi": "./bin/nuxt.mjs",
|
||||||
"nuxt": "./bin/nuxt.mjs"
|
"nuxt": "./bin/nuxt.mjs"
|
||||||
},
|
},
|
||||||
|
"exports": {
|
||||||
|
".": "./dist/index.mjs",
|
||||||
|
"./app": "./dist/app/index.mjs",
|
||||||
|
"./package.json": "./package.json"
|
||||||
|
},
|
||||||
|
"imports": {
|
||||||
|
"#app": "./dist/app/index.mjs",
|
||||||
|
"#meta": "./dist/meta/runtime/index.mjs",
|
||||||
|
"#pages": "./dist/pages/runtime/index.mjs"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"app.d.ts",
|
||||||
"bin",
|
"bin",
|
||||||
"types.d.ts",
|
"types.d.ts",
|
||||||
"dist"
|
"dist"
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
|
/// <reference path="types/augments.d.ts" />
|
||||||
|
|
||||||
export * from './nuxt'
|
export * from './nuxt'
|
||||||
export * from './composables'
|
export * from './composables'
|
||||||
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
|
export type { PageMeta } from '../pages/runtime'
|
||||||
|
// eslint-disable-next-line import/no-restricted-paths
|
||||||
|
export type { MetaObject } from '../meta/runtime'
|
||||||
|
export { useMeta } from '#meta'
|
||||||
|
|
||||||
export const isVue2 = false
|
export const isVue2 = false
|
||||||
export const isVue3 = true
|
export const isVue3 = true
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
import './augments'
|
|
||||||
|
|
||||||
export * from '../index'
|
|
@ -13,7 +13,7 @@ interface ImportProtectionOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const vueAppPatterns = (nuxt: Nuxt) => [
|
export const vueAppPatterns = (nuxt: Nuxt) => [
|
||||||
[/^(nuxt3|nuxt)/, '`nuxt3`/`nuxt` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
|
[/^(nuxt3|nuxt)$/, '`nuxt3`/`nuxt` cannot be imported directly. Instead, import runtime Nuxt composables from `#app` or `#imports`.'],
|
||||||
[/nuxt\.config/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'],
|
[/nuxt\.config/, 'Importing directly from a `nuxt.config` file is not allowed. Instead, use runtime config or a module.'],
|
||||||
[/(^|node_modules\/)@vue\/composition-api/],
|
[/(^|node_modules\/)@vue\/composition-api/],
|
||||||
...nuxt.options.modules.filter(m => typeof m === 'string').map((m: string) =>
|
...nuxt.options.modules.filter(m => typeof m === 'string').map((m: string) =>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createMetaManager } from 'vue-meta'
|
import { createMetaManager } from 'vue-meta'
|
||||||
import type { MetaObject } from '../types'
|
import type { MetaObject } from '..'
|
||||||
import { defineNuxtPlugin } from '#app'
|
import { defineNuxtPlugin } from '#app'
|
||||||
|
|
||||||
export default defineNuxtPlugin((nuxtApp) => {
|
export default defineNuxtPlugin((nuxtApp) => {
|
||||||
|
1
packages/nuxt3/src/pages/runtime/index.ts
Normal file
1
packages/nuxt3/src/pages/runtime/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './composables'
|
1
packages/nuxt3/types.d.ts
vendored
1
packages/nuxt3/types.d.ts
vendored
@ -1,3 +1,2 @@
|
|||||||
import type { } from '@nuxt/nitro'
|
import type { } from '@nuxt/nitro'
|
||||||
export * from './dist/index'
|
export * from './dist/index'
|
||||||
export * from './dist/app/types/index'
|
|
||||||
|
@ -46,8 +46,7 @@ export async function buildServer (ctx: ViteBuildContext) {
|
|||||||
/\.(es|esm|esm-browser|esm-bundler).js$/,
|
/\.(es|esm|esm-browser|esm-bundler).js$/,
|
||||||
'/__vue-jsx',
|
'/__vue-jsx',
|
||||||
'#app',
|
'#app',
|
||||||
/nuxt3\/dist/,
|
'nuxt3',
|
||||||
/nuxt3\/src/,
|
|
||||||
/@nuxt\/nitro\/dist/,
|
/@nuxt\/nitro\/dist/,
|
||||||
/@nuxt\/nitro\/src/
|
/@nuxt\/nitro\/src/
|
||||||
]
|
]
|
||||||
|
@ -38,6 +38,7 @@ function serverStandalone (ctx: WebpackConfigContext) {
|
|||||||
const inline = [
|
const inline = [
|
||||||
'src/',
|
'src/',
|
||||||
'#app',
|
'#app',
|
||||||
|
'nuxt3',
|
||||||
'!',
|
'!',
|
||||||
'-!',
|
'-!',
|
||||||
'~',
|
'~',
|
||||||
|
Loading…
Reference in New Issue
Block a user