Skip to content

Commit

Permalink
fix(transformers): errors.map is not a function (#7672)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweetliquid committed Mar 20, 2022
1 parent 63f2a18 commit c9a4238
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions packages/transformers/html/src/HTMLTransformer.js
Expand Up @@ -41,19 +41,22 @@ export default (new Transformer({
try {
hasScripts = collectDependencies(asset, ast);
} catch (errors) {
throw new ThrowableDiagnostic({
diagnostic: errors.map(error => ({
message: error.message,
origin: '@parcel/transformer-html',
codeFrames: [
{
filePath: error.filePath,
language: 'html',
codeHighlights: [error.loc],
},
],
})),
});
if (Array.isArray(errors)) {
throw new ThrowableDiagnostic({
diagnostic: errors.map(error => ({
message: error.message,
origin: '@parcel/transformer-html',
codeFrames: [
{
filePath: error.filePath,
language: 'html',
codeHighlights: [error.loc],
},
],
})),
});
}
throw errors;
}

const {assets: inlineAssets, hasScripts: hasInlineScripts} =
Expand Down

0 comments on commit c9a4238

Please sign in to comment.