From b17a5f4b11c4b9a8c684374e4f4cbd767b904b48 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 5 Apr 2025 15:30:20 -0700 Subject: [PATCH] fix(prepare): provide module name as alias --- src/commands/prepare.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/commands/prepare.ts b/src/commands/prepare.ts index e6527681..0bfff8e8 100644 --- a/src/commands/prepare.ts +++ b/src/commands/prepare.ts @@ -1,6 +1,7 @@ import type { NuxtConfig } from '@nuxt/schema' import { defineCommand } from 'citty' import { resolve } from 'pathe' +import { readPackageJSON } from 'pkg-types' export default defineCommand({ meta: { @@ -20,11 +21,13 @@ export default defineCommand({ }, async run(context) { const { runCommand } = await import('@nuxt/cli') + const moduleName = await readPackageJSON(context.args.rootDir, { try: true }).then(r => r.name) const cwd = resolve(context.args.cwd || context.args.rootDir || '.') return runCommand('prepare', [cwd], { overrides: { + alias: moduleName ? { [moduleName]: resolve(cwd, './src/module') } : {}, compatibilityDate: '2024-04-03', typescript: { builder: 'shared',