From 33002dd06c6ed1b97ec8fd2714b02bd80df99e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=B1=84=EC=A4=80=20-=20CJ=20Lee?= Date: Thu, 20 Jul 2023 23:21:53 +0900 Subject: [PATCH] fix(build): remove warning about ineffective dynamic import from node_modules (#13884) --- packages/vite/src/node/plugins/reporter.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/vite/src/node/plugins/reporter.ts b/packages/vite/src/node/plugins/reporter.ts index 0135f552e8845d..2584ab5db3e654 100644 --- a/packages/vite/src/node/plugins/reporter.ts +++ b/packages/vite/src/node/plugins/reporter.ts @@ -4,7 +4,7 @@ import { promisify } from 'node:util' import colors from 'picocolors' import type { Plugin } from 'rollup' import type { ResolvedConfig } from '../config' -import { isDefined, normalizePath } from '../utils' +import { isDefined, isInNodeModules, normalizePath } from '../utils' import { LogLevels } from '../logger' const groups = [ @@ -122,9 +122,10 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin { // the same chunk. The intersecting dynamic importers' dynamic import is not // expected to work. Note we're only detecting the direct ineffective // dynamic import here. - if ( - module.dynamicImporters.some((m) => chunk.moduleIds.includes(m)) - ) { + const detectedIneffectiveDynamicImport = module.dynamicImporters.some( + (id) => !isInNodeModules(id) && chunk.moduleIds.includes(id), + ) + if (detectedIneffectiveDynamicImport) { this.warn( `\n(!) ${ module.id