Skip to content

Commit 33002dd

Browse files
authoredJul 20, 2023
fix(build): remove warning about ineffective dynamic import from node_modules (#13884)
1 parent 5a56941 commit 33002dd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎packages/vite/src/node/plugins/reporter.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { promisify } from 'node:util'
44
import colors from 'picocolors'
55
import type { Plugin } from 'rollup'
66
import type { ResolvedConfig } from '../config'
7-
import { isDefined, normalizePath } from '../utils'
7+
import { isDefined, isInNodeModules, normalizePath } from '../utils'
88
import { LogLevels } from '../logger'
99

1010
const groups = [
@@ -122,9 +122,10 @@ export function buildReporterPlugin(config: ResolvedConfig): Plugin {
122122
// the same chunk. The intersecting dynamic importers' dynamic import is not
123123
// expected to work. Note we're only detecting the direct ineffective
124124
// dynamic import here.
125-
if (
126-
module.dynamicImporters.some((m) => chunk.moduleIds.includes(m))
127-
) {
125+
const detectedIneffectiveDynamicImport = module.dynamicImporters.some(
126+
(id) => !isInNodeModules(id) && chunk.moduleIds.includes(id),
127+
)
128+
if (detectedIneffectiveDynamicImport) {
128129
this.warn(
129130
`\n(!) ${
130131
module.id

0 commit comments

Comments
 (0)
Please sign in to comment.