From 814dc64a95c4d80360ae41a5104cc1f3fc492987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Dethier?= Date: Mon, 2 May 2022 15:40:15 +0200 Subject: [PATCH] fix: exclude CJS files with file loader (#11889) --- packages/react-scripts/config/webpack.config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index e465d8e7a00..18126dd4bf6 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -594,7 +594,12 @@ module.exports = function (webpackEnv) { // its runtime that would otherwise be processed through "file" loader. // Also exclude `html` and `json` extensions so they get processed // by webpacks internal loaders. - exclude: [/^$/, /\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], + exclude: [ + /^$/, + /\.(js|mjs|jsx|ts|tsx|cjs)$/, + /\.html$/, + /\.json$/, + ], type: 'asset/resource', }, // ** STOP ** Are you adding a new loader?