fix(cli): suppress protobufjs/inquire dynamic require warning in bundler
Since protobufjs 7.5.9, the @protobufjs/inquire utility is no longer called with dynamic module names (replaced by bundler-safe lookups in protobufjs/protobuf.js#2254). However, webpack/rspack still statically analyzes the inquire source and emits a "Critical dependency" warning for its require(moduleName) pattern. This is a false positive — the code path is dead in practice. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -394,16 +394,25 @@ export async function createConfig(
|
||||
}),
|
||||
},
|
||||
plugins,
|
||||
...(options.moduleFederationRemote && {
|
||||
ignoreWarnings: [
|
||||
// @protobufjs/inquire uses require(moduleName) with a dynamic argument.
|
||||
// Since protobufjs >=7.5.9 this code path is never exercised (the
|
||||
// bundler-safe optional module lookups backport replaced all call sites),
|
||||
// but webpack/rspack still statically analyzes the source and emits a
|
||||
// "Critical dependency" warning. Safe to suppress.
|
||||
// See https://github.com/protobufjs/protobuf.js/issues/2057
|
||||
{ module: /@protobufjs[\\/]inquire/ },
|
||||
// TODO: remove this warning skipping as soon as the corresponding bundler limitation
|
||||
// described in issue https://github.com/web-infra-dev/rspack/issues/13635 is fixed
|
||||
// when PR: https://github.com/web-infra-dev/rspack/pull/13636 is merged.
|
||||
ignoreWarnings: [
|
||||
{
|
||||
message:
|
||||
/No version specified and unable to automatically determine one\. No version in description file/,
|
||||
},
|
||||
],
|
||||
}),
|
||||
...(options.moduleFederationRemote
|
||||
? [
|
||||
{
|
||||
message:
|
||||
/No version specified and unable to automatically determine one\. No version in description file/,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user