diff --git a/packages/app/meta.js b/packages/app/meta.js new file mode 100644 index 0000000000..527b1c77e5 --- /dev/null +++ b/packages/app/meta.js @@ -0,0 +1,5 @@ +const { resolve } = require('path') + +module.exports = { + appDir: resolve(__dirname, 'dist') +} diff --git a/packages/app/package.json b/packages/app/package.json index a6766c6e9d..a27e327d43 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -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 .", diff --git a/packages/app/src/index.js b/packages/app/src/index.js new file mode 100644 index 0000000000..a33240b654 --- /dev/null +++ b/packages/app/src/index.js @@ -0,0 +1 @@ +export * from './index.ts' diff --git a/packages/nuxt3/src/nuxt.ts b/packages/nuxt3/src/nuxt.ts index d7f3621140..c16e9d6130 100644 --- a/packages/nuxt3/src/nuxt.ts +++ b/packages/nuxt3/src/nuxt.ts @@ -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 { }) // 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)