Skip to content

Commit 194e77c

Browse files
authored
fix: write globalTypes into dist for correct export (#4740)
1 parent ecaa9f9 commit 194e77c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

packages/language-core/lib/codegen/script/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface ScriptCodegenOptions {
5151
export function* generateScript(options: ScriptCodegenOptions): Generator<Code, ScriptCodegenContext> {
5252
const ctx = createScriptCodegenContext(options);
5353

54-
yield `/// <reference types="${options.vueCompilerOptions.lib}/__globalTypes_${options.vueCompilerOptions.target}_${options.vueCompilerOptions.strictTemplates}" />${newLine}`;
54+
yield `/// <reference types="${options.vueCompilerOptions.lib}/dist/__globalTypes_${options.vueCompilerOptions.target}_${options.vueCompilerOptions.strictTemplates}.d.ts" />${newLine}`;
5555

5656
if (options.sfc.script?.src) {
5757
yield* generateSrc(options.sfc.script, options.sfc.script.src);

packages/tsc/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function run(tscPath = require.resolve('typescript/lib/tsc')) {
2727
: options.host?.getCurrentDirectory() ?? ts.sys.getCurrentDirectory();
2828
const libDir = require.resolve(`${vueOptions.lib}/package.json`, { paths: [rootDir] })
2929
.slice(0, -'package.json'.length);
30-
const globalTypesPath = `${libDir}__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`;
30+
const globalTypesPath = `${libDir}dist/__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`;
3131
const globalTypesContents = vue.generateGlobalTypes(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates);
3232
ts.sys.writeFile(globalTypesPath, globalTypesContents);
3333
} catch { }

packages/tsc/tests/dts.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('vue-tsc-dts', () => {
3737
: options.host?.getCurrentDirectory() ?? ts.sys.getCurrentDirectory();
3838
const libDir = require.resolve(`${vueOptions.lib}/package.json`, { paths: [rootDir] })
3939
.slice(0, -'package.json'.length);
40-
const globalTypesPath = `${libDir}__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`;
40+
const globalTypesPath = `${libDir}dist/__globalTypes_${vueOptions.target}_${vueOptions.strictTemplates}.d.ts`;
4141
const globalTypesContents = vue.generateGlobalTypes(vueOptions.lib, vueOptions.target, vueOptions.strictTemplates);
4242
ts.sys.writeFile(globalTypesPath, globalTypesContents);
4343
} catch { }

packages/typescript-plugin/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const plugin: ts.server.PluginModuleFactory = mods => {
6363
try {
6464
const libDir = require.resolve(`${options.lib}/package.json`, { paths: [proj.getCurrentDirectory()] })
6565
.slice(0, -'package.json'.length);
66-
const globalTypesPath = `${libDir}__globalTypes_${options.target}_${options.strictTemplates}.d.ts`;
66+
const globalTypesPath = `${libDir}dist/__globalTypes_${options.target}_${options.strictTemplates}.d.ts`;
6767
const globalTypesContents = vue.generateGlobalTypes(options.lib, options.target, options.strictTemplates);
6868
proj.writeFile(globalTypesPath, globalTypesContents);
6969
} catch { }

0 commit comments

Comments
 (0)