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",
"license": "MIT",
"main": "./dist/index.js",
"module": "./dist/index.js",
"files": [
"dist"
"dist",
"meta.js"
],
"scripts": {
"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 { loadNuxtConfig, LoadNuxtConfigOptions, Nuxt, NuxtOptions, installModule } from '@nuxt/kit'
import { initNitro } from './nitro'
@ -52,8 +51,8 @@ export async function loadNuxt (loadOpts: LoadNuxtOptions = {}): Promise<Nuxt> {
})
// Temp
// @ts-ignore
options.appDir = dirname(require.resolve('@nuxt/app'))
const { appDir } = await import('@nuxt/app/meta')
options.appDir = appDir
options._majorVersion = 3
const nuxt = createNuxt(options)