Handle @webgpu/types in standalone script

This commit is contained in:
Daniel Imms
2024-09-09 08:48:31 -07:00
parent 259227f99b
commit 32ba9d0576
2 changed files with 11 additions and 2 deletions

View File

@@ -51,7 +51,12 @@ function extractEditor(options) {
// Add extra .d.ts files from `node_modules/@types/`
if (Array.isArray(options.compilerOptions?.types)) {
options.compilerOptions.types.forEach((type) => {
options.typings.push(`../node_modules/@types/${type}/index.d.ts`);
if (type === '@webgpu/types') {
options.typings.push(`../node_modules/${type}/dist/index.d.ts`);
}
else {
options.typings.push(`../node_modules/@types/${type}/index.d.ts`);
}
});
}
const result = tss.shake(options);

View File

@@ -59,7 +59,11 @@ export function extractEditor(options: tss.ITreeShakingOptions & { destRoot: str
// Add extra .d.ts files from `node_modules/@types/`
if (Array.isArray(options.compilerOptions?.types)) {
options.compilerOptions.types.forEach((type: string) => {
options.typings.push(`../node_modules/@types/${type}/index.d.ts`);
if (type === '@webgpu/types') {
options.typings.push(`../node_modules/${type}/dist/index.d.ts`);
} else {
options.typings.push(`../node_modules/@types/${type}/index.d.ts`);
}
});
}