Skip to content

Commit 7c8bc0c

Browse files
committed
Re-add the ignore warnings for dynamic modules
1 parent c3d0098 commit 7c8bc0c

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

rsbuild.config.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,25 @@ export default defineConfig({
8686
// }
8787
// });
8888

89-
// config.ignoreWarnings = [
90-
// {
91-
// // Ignore warnings for dependencies that do not ship with a source map.
92-
// // This is because we cannot do anything about our dependencies.
93-
// module: /node_modules/,
94-
// message: /Failed to parse source map/
95-
// },
96-
// {
97-
// // Ignore the warnings that occur because js-slang uses dynamic imports
98-
// // to load Source modules
99-
// module: /js-slang\/dist\/modules\/loader\/loaders.js/,
100-
// message: /Critical dependency: the request of a dependency is an expression/
101-
// }
102-
// ];
89+
config.ignoreWarnings = [
90+
(warning: any) => {
91+
// Ignore the warnings that occur because js-slang uses dynamic imports
92+
// to load Source modules
93+
const moduleName = warning.moduleDescriptor?.name
94+
if (!moduleName) return false
95+
96+
if (!/js-slang\/dist\/modules\/loader\/loaders.js/.test(moduleName)) return false
97+
return /Critical dependency: the request of a dependency is an expression/.test(warning.message)
98+
}
99+
100+
// {
101+
// // Ignore warnings for dependencies that do not ship with a source map.
102+
// // This is because we cannot do anything about our dependencies.
103+
// module: /node_modules/,
104+
// message: /Failed to parse source map/
105+
// },
106+
// [
107+
];
103108

104109
// config.plugins = [
105110
// ...config.plugins,

0 commit comments

Comments
 (0)