Skip to content

Commit c6718fe

Browse files
committed
Ensure that Rule.parser does not match JSON for requireEnsure: false setting
1 parent 33cf366 commit c6718fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/react-scripts/config/webpack.config.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,11 @@ module.exports = function(webpackEnv) {
343343
strictExportPresence: true,
344344
rules: [
345345
// Disable require.ensure as it's not a standard language feature.
346-
{ parser: { requireEnsure: false } },
346+
// Webpack 5 Change: We had to add a type to continue to remove requireEnsure since otherwise it thinks the Rule.type is json.
347+
// This might be a Webpack 5 bug.
348+
// See https://github.com/smelukov/webpack.js.org/blob/ceba5c77f7964e7982a1b666905924d89e4a2d4c/src/content/configuration/module.mdx#ruleparserparse
349+
// See https://github.com/webpack/webpack/pull/10054
350+
{ type: 'javascript/auto', parser: { requireEnsure: false } },
347351

348352
// First, run the linter.
349353
// It's important to do this before Babel processes the JS.

0 commit comments

Comments
 (0)