Skip to content

Commit

Permalink
fix(build): remove warning about ineffective dynamic import from node…
Browse files Browse the repository at this point in the history
…_modules (#13884)
  • Loading branch information
chaejunlee authored Jul 20, 2023
1 parent 5a56941 commit 33002dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/vite/src/node/plugins/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 33002dd

Please sign in to comment.