mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
refactor(nitro): use # prefix for aliases (#101)
This commit is contained in:
parent
1b10a1f091
commit
5646770cd1
@ -174,7 +174,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
...nitroContext.middleware
|
||||
]
|
||||
if (nitroContext.serveStatic) {
|
||||
_middleware.unshift({ route: '/', handle: '~runtime/server/static' })
|
||||
_middleware.unshift({ route: '/', handle: '#nitro/server/static' })
|
||||
}
|
||||
return _middleware
|
||||
}))
|
||||
@ -189,10 +189,10 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
|
||||
const vue2ServerRenderer = 'vue-server-renderer/' + (nitroContext._nuxt.dev ? 'build.dev.js' : 'build.prod.js')
|
||||
rollupConfig.plugins.push(alias({
|
||||
entries: {
|
||||
'~runtime': nitroContext._internal.runtimeDir,
|
||||
'~renderer': require.resolve(resolve(nitroContext._internal.runtimeDir, 'app', renderer)),
|
||||
'~vueServerRenderer': vue2ServerRenderer,
|
||||
'~build': nitroContext._nuxt.buildDir,
|
||||
'#nitro': nitroContext._internal.runtimeDir,
|
||||
'#nitro-renderer': require.resolve(resolve(nitroContext._internal.runtimeDir, 'app', renderer)),
|
||||
'#nitro-vue-renderer': vue2ServerRenderer,
|
||||
'#build': nitroContext._nuxt.buildDir,
|
||||
...env.alias
|
||||
}
|
||||
}))
|
||||
|
@ -38,7 +38,7 @@ export function statAsset (id) {
|
||||
|
||||
if (!opts.inline) {
|
||||
return virtual({
|
||||
'~nitro/assets': `
|
||||
'#assets': `
|
||||
import { statSync, promises as fsp } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
|
||||
@ -68,7 +68,7 @@ export function getAsset (id) {
|
||||
}
|
||||
|
||||
return virtual({
|
||||
'~nitro/assets': {
|
||||
'#assets': {
|
||||
async load () {
|
||||
const assets: Record<string, Asset> = {}
|
||||
for (const assetdir in opts.dirs) {
|
||||
|
@ -18,7 +18,7 @@ export function externals (opts: NodeExternalsOptions): Plugin {
|
||||
name: 'node-externals',
|
||||
resolveId (id) {
|
||||
// Internals
|
||||
if (!id || id.startsWith('\x00') || id.includes('?')) {
|
||||
if (!id || id.startsWith('\x00') || id.includes('?') || id.startsWith('#')) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ export function storage (opts: StorageOptions) {
|
||||
const driverImports = Array.from(new Set(mounts.map(m => m.driver)))
|
||||
|
||||
return virtual({
|
||||
'~nitro/storage': `
|
||||
'#storage': `
|
||||
import { createStorage } from 'unstorage'
|
||||
${driverImports.map(i => `import ${getImportName(i)} from '${i}'`).join('\n')}
|
||||
|
||||
|
@ -2,13 +2,13 @@ import { createRenderer } from 'vue-bundle-renderer'
|
||||
import devalue from '@nuxt/devalue'
|
||||
import config from './config'
|
||||
// @ts-ignore
|
||||
import { renderToString } from '~renderer'
|
||||
import { renderToString } from '#nitro-renderer'
|
||||
// @ts-ignore
|
||||
import createApp from '~build/dist/server/server'
|
||||
import createApp from '#build/dist/server/server'
|
||||
// @ts-ignore
|
||||
import clientManifest from '~build/dist/server/client.manifest.json'
|
||||
import clientManifest from '#build/dist/server/client.manifest.json'
|
||||
// @ts-ignore
|
||||
import htmlTemplate from '~build/views/document.template.js'
|
||||
import htmlTemplate from '#build/views/document.template.js'
|
||||
|
||||
function _interopDefault (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e }
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// @ts-ignore
|
||||
import { createRenderer } from '~vueServerRenderer'
|
||||
import { createRenderer } from '#nitro-vue-renderer'
|
||||
const _renderer = createRenderer({})
|
||||
|
||||
// @ts-ignore
|
||||
|
@ -1,6 +1,6 @@
|
||||
// @ts-ignore
|
||||
import { builderFunction } from '@netlify/functions'
|
||||
// @ts-ignore
|
||||
import { handler as _handler } from '~runtime/entries/lambda'
|
||||
import { handler as _handler } from '#nitro/entries/lambda'
|
||||
|
||||
export const handler = builderFunction(_handler)
|
||||
|
Loading…
Reference in New Issue
Block a user