Skip to content

Commit

Permalink
fix traced warnings from unexpected token (#6810)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
styfle and Rich-Harris authored Sep 14, 2022
1 parent 4627417 commit 2040bae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/immaculate-error-handler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sveltejs/adapter-vercel': patch
---

Ignore warnings when traced file fails to parse

5 changes: 5 additions & 0 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ async function create_function_bundle(builder, entry, dir, runtime) {
// pending https://github.com/vercel/nft/issues/284
if (error.message.startsWith('Failed to resolve dependency node:')) return;

// parse errors are likely not js and can safely be ignored,
// such as this html file in "main" meant for nw instead of node:
// https://github.com/vercel/nft/issues/311
if (error.message.startsWith('Failed to parse')) return;

if (error.message.startsWith('Failed to resolve dependency')) {
const match = /Cannot find module '(.+?)' loaded from (.+)/;
const [, module, importer] = match.exec(error.message);
Expand Down

0 comments on commit 2040bae

Please sign in to comment.