From 288160f2e7b709e163a786c0ebeaa5f48eabafe6 Mon Sep 17 00:00:00 2001 From: Fernando Paredes Garcia Date: Thu, 17 Apr 2025 18:36:57 -0500 Subject: [PATCH] Clean source maps and old polifyll warnings. --- craco.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/craco.config.js b/craco.config.js index f939a91..3269dff 100644 --- a/craco.config.js +++ b/craco.config.js @@ -11,6 +11,7 @@ module.exports = { constants: require.resolve('constants-browserify'), fs: false, // Can't polyfill in browser os: false, + vm: false, }; config.plugins.push( @@ -20,6 +21,23 @@ module.exports = { }) ); + config.module.rules = config.module.rules.filter(rule => { + if (rule.enforce === 'pre') { + // if it’s declared via `loader` + if (rule.loader && rule.loader.includes('source-map-loader')) { + return false; + } + // or if it’s declared via `use: […]` + if (rule.use && rule.use.some(u => + (typeof u === 'string' && u.includes('source-map-loader')) || + (u.loader && u.loader.includes('source-map-loader')) + )) { + return false; + } + } + return true; + }); + return config; }, },