Skip to content

Commit 13d096c

Browse files
Hari KiranHari Kiran
authored andcommitted
Fix: Use CommonJS syntax in craco.config.js to avoid syntax errors
1 parent dc25a4d commit 13d096c

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

craco.config.js

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

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

18-
return webpackConfig;
19-
},
20-
};
16+
// ✅ This suppresses the "Critical dependency" warning explicitly
17+
webpackConfig.ignoreWarnings = [/the request of a dependency is an expression/];
18+
return webpackConfig;
19+
},
20+
},
21+
};
22+

0 commit comments

Comments
 (0)