Skip to content

Commit 85046d1

Browse files
Hari KiranHari Kiran
authored andcommitted
Fix: Suppressed Webpack critical dependency warning
1 parent 17f0ee9 commit 85046d1

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

craco.config.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
module.exports = {
2-
webpack: {
3-
configure: (webpackConfig) => {
4-
webpackConfig.resolve.fallback = {
5-
...webpackConfig.resolve.fallback,
6-
path: require.resolve("path-browserify"),
7-
};
1+
export const webpack = {
2+
configure: (webpackConfig) => {
3+
webpackConfig.resolve.fallback = {
4+
...webpackConfig.resolve.fallback,
5+
path: require.resolve("path-browserify"),
6+
};
87

9-
webpackConfig.module.rules.push({
10-
test: /\.js$/,
11-
parser: {
12-
requireEnsure: false, // Prevents Webpack from complaining about dynamic requires
13-
},
14-
});
15-
return webpackConfig;
8+
webpackConfig.module.rules.push({
9+
test: /\.js$/,
10+
parser: {
11+
requireEnsure: false, // Prevents Webpack from treating require() as a critical dependency
1612
},
17-
},
18-
};
19-
13+
});
14+
15+
// ✅ This suppresses the "Critical dependency" warning explicitly
16+
webpackConfig.ignoreWarnings = [/the request of a dependency is an expression/];
17+
18+
return webpackConfig;
19+
},
20+
};

0 commit comments

Comments
 (0)