fix(app): provide appDir via meta export

This commit is contained in:
Pooya Parsa 2021-04-03 17:08:42 +02:00
parent f47808f59a
commit 94d36976c7
4 changed files with 11 additions and 4 deletions

5
packages/app/meta.js Normal file
View File

@ -0,0 +1,5 @@
const { resolve } = require('path')
module.exports = {
appDir: resolve(__dirname, 'dist')
}

View File

@ -4,8 +4,10 @@
"repository": "nuxt/framework", "repository": "nuxt/framework",
"license": "MIT", "license": "MIT",
"main": "./dist/index.js", "main": "./dist/index.js",
"module": "./dist/index.js",
"files": [ "files": [
"dist" "dist",
"meta.js"
], ],
"scripts": { "scripts": {
"build": "jiti ../../scripts/build .", "build": "jiti ../../scripts/build .",

View File

@ -0,0 +1 @@
export * from './index.ts'

View File

@ -1,4 +1,3 @@
import { dirname } from 'path'
import Hookable from 'hookable' import Hookable from 'hookable'
import { loadNuxtConfig, LoadNuxtConfigOptions, Nuxt, NuxtOptions, installModule } from '@nuxt/kit' import { loadNuxtConfig, LoadNuxtConfigOptions, Nuxt, NuxtOptions, installModule } from '@nuxt/kit'
import { initNitro } from './nitro' import { initNitro } from './nitro'
@ -52,8 +51,8 @@ export async function loadNuxt (loadOpts: LoadNuxtOptions = {}): Promise<Nuxt> {
}) })
// Temp // Temp
// @ts-ignore const { appDir } = await import('@nuxt/app/meta')
options.appDir = dirname(require.resolve('@nuxt/app')) options.appDir = appDir
options._majorVersion = 3 options._majorVersion = 3
const nuxt = createNuxt(options) const nuxt = createNuxt(options)