From 2040baee98cf85fe542e1e38a9fb60ede3f95f1d Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 14 Sep 2022 11:50:06 -0400 Subject: [PATCH] fix traced warnings from unexpected token (#6810) * fix traced warnings from unexpected token * Failed to parse Co-authored-by: Rich Harris * fix lint * add changeset Co-authored-by: Rich Harris --- .changeset/immaculate-error-handler.md | 6 ++++++ packages/adapter-vercel/index.js | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 .changeset/immaculate-error-handler.md diff --git a/.changeset/immaculate-error-handler.md b/.changeset/immaculate-error-handler.md new file mode 100644 index 000000000000..bc16312babbc --- /dev/null +++ b/.changeset/immaculate-error-handler.md @@ -0,0 +1,6 @@ +--- +'@sveltejs/adapter-vercel': patch +--- + +Ignore warnings when traced file fails to parse + diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 37027c836f7a..071d025e760e 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -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);