more transpile tweaks

pull/230238/head
Johannes 2024-10-02 10:04:41 +02:00
parent c1fb7325bd
commit 3ae94fbae4
No known key found for this signature in database
GPG Key ID: 6DEF802A22264FCA
2 changed files with 19 additions and 2 deletions

View File

@ -251,12 +251,20 @@ class ESBuildTranspiler {
const t1 = Date.now();
this._jobs.push(esbuild.transform(file.contents, {
target: ['es2022'],
format: this._cmdLine.options.module === ts.ModuleKind.CommonJS ? 'cjs' : 'esm',
loader: 'ts',
tsconfigRaw: JSON.stringify({ compilerOptions: this._cmdLine.options }),
tsconfigRaw: JSON.stringify({
compilerOptions: this._cmdLine.options
}),
supported: {
'class-static-blocks': false // SEE https://github.com/evanw/esbuild/issues/3823
}
}).then(result => {
// check if output of a DTS-files isn't just "empty" and iff so
// skip this file
if (file.path.endsWith('.d.ts') && _isDefaultEmpty(result.code)) {
return;
}
const outBase = this._cmdLine.options.outDir ?? file.base;
const outPath = this._outputFileNames.getOutputFileName(file.path);
this.onOutfile(new Vinyl({

View File

@ -322,13 +322,22 @@ export class ESBuildTranspiler implements ITranspiler {
const t1 = Date.now();
this._jobs.push(esbuild.transform(file.contents, {
target: ['es2022'],
format: this._cmdLine.options.module === ts.ModuleKind.CommonJS ? 'cjs' : 'esm',
loader: 'ts',
tsconfigRaw: JSON.stringify({ compilerOptions: this._cmdLine.options }),
tsconfigRaw: JSON.stringify({
compilerOptions: this._cmdLine.options
}),
supported: {
'class-static-blocks': false // SEE https://github.com/evanw/esbuild/issues/3823
}
}).then(result => {
// check if output of a DTS-files isn't just "empty" and iff so
// skip this file
if (file.path.endsWith('.d.ts') && _isDefaultEmpty(result.code)) {
return;
}
const outBase = this._cmdLine.options.outDir ?? file.base;
const outPath = this._outputFileNames.getOutputFileName(file.path);