From d88c5819b0bd481d3db80b3033b25967f3c4af32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 25 Sep 2024 17:06:45 +0900 Subject: [PATCH] fix: ignore directive sourcemap error (#369) --- packages/plugin-react/src/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index 9d2356e3..cff959b0 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -326,6 +326,14 @@ const silenceUseClientWarning = (userConfig: UserConfig): BuildOptions => ({ ) { return } + // https://github.com/vitejs/vite/issues/15012 + if ( + warning.code === 'SOURCEMAP_ERROR' && + warning.message.includes('resolve original location') && + warning.pos === 0 + ) { + return + } if (userConfig.build?.rollupOptions?.onwarn) { userConfig.build.rollupOptions.onwarn(warning, defaultHandler) } else {