esbuild-loader
Advanced tools
Comparing version 2.9.1 to 2.9.2
@@ -24,3 +24,3 @@ "use strict"; | ||
}); | ||
const tsxTryTsLoaderPtrn = /Unexpected|Expected/; | ||
const isTsExtensionPtrn = /\.ts$/i; | ||
let tsConfig; | ||
@@ -51,14 +51,10 @@ async function ESBuildLoader(source) { | ||
} | ||
// https://github.com/privatenumber/esbuild-loader/pull/107 | ||
if (transformOptions.loader === 'tsx' | ||
&& isTsExtensionPtrn.test(this.resourcePath)) { | ||
transformOptions.loader = 'ts'; | ||
} | ||
try { | ||
const result = await service.transform(source, transformOptions).catch(async (error) => { | ||
// Target might be a TS file accidentally parsed as TSX | ||
if (transformOptions.loader === 'tsx' && tsxTryTsLoaderPtrn.test(error.message)) { | ||
transformOptions.loader = 'ts'; | ||
return service.transform(source, transformOptions).catch(_ => { | ||
throw error; | ||
}); | ||
} | ||
throw error; | ||
}); | ||
done(null, result.code, result.map && JSON.parse(result.map)); | ||
const { code, map } = await service.transform(source, transformOptions); | ||
done(null, code, map && JSON.parse(map)); | ||
} | ||
@@ -65,0 +61,0 @@ catch (error) { |
{ | ||
"name": "esbuild-loader", | ||
"version": "2.9.1", | ||
"version": "2.9.2", | ||
"description": "⚡️ Speed up your Webpack build with esbuild", | ||
@@ -14,2 +14,3 @@ "keywords": [ | ||
"repository": "privatenumber/esbuild-loader", | ||
"funding": "https://github.com/privatenumber/esbuild-loader?sponsor=1", | ||
"author": { | ||
@@ -16,0 +17,0 @@ "name": "Hiroki Osame", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17682
231