Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): remove warning about ineffective dynamic import from node_modules #13884

Merged
merged 8 commits into from
Jul 20, 2023
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