Skip to content

Commit 2040bae

Browse files
styfleRich-Harris
andauthored
fix traced warnings from unexpected token (#6810)
* fix traced warnings from unexpected token * Failed to parse Co-authored-by: Rich Harris <hello@rich-harris.dev> * fix lint * add changeset Co-authored-by: Rich Harris <hello@rich-harris.dev>
1 parent 4627417 commit 2040bae

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
---
4+
5+
Ignore warnings when traced file fails to parse
6+

packages/adapter-vercel/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ async function create_function_bundle(builder, entry, dir, runtime) {
308308
// pending https://github.com/vercel/nft/issues/284
309309
if (error.message.startsWith('Failed to resolve dependency node:')) return;
310310

311+
// parse errors are likely not js and can safely be ignored,
312+
// such as this html file in "main" meant for nw instead of node:
313+
// https://github.com/vercel/nft/issues/311
314+
if (error.message.startsWith('Failed to parse')) return;
315+
311316
if (error.message.startsWith('Failed to resolve dependency')) {
312317
const match = /Cannot find module '(.+?)' loaded from (.+)/;
313318
const [, module, importer] = match.exec(error.message);

0 commit comments

Comments
 (0)