Skip to content

Commit 74ff2a9

Browse files
authored
Allow "type": "module" in package.json w/out ext (#3)
1 parent 7aa98da commit 74ff2a9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,19 @@ module.exports = function (webpackEnv) {
414414
test: /\.(js|mjs|jsx|ts|tsx)$/,
415415
include: paths.appSrc,
416416
loader: require.resolve('babel-loader'),
417+
// Allow "type": "module" in package.json without
418+
// fully-specified file extension
419+
// https://webpack.js.org/configuration/module/#resolvefullyspecified
420+
//
421+
// We require "type": "module" in package.json because
422+
// ESLint we want to use ESM syntax in our eslint.config.js
423+
// file and ESLint does not support other ways of specifying
424+
// that the config file is ESM such as an .mjs extension:
425+
// https://github.com/eslint/eslint/issues/13440
426+
// https://github.com/eslint/eslint/issues/16580
427+
resolve: {
428+
fullySpecified: false,
429+
},
417430
options: {
418431
customize: require.resolve(
419432
'babel-preset-react-app/webpack-overrides',

packages/react-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@upleveled/react-scripts",
3-
"version": "5.0.11",
3+
"version": "5.0.13",
44
"description": "Configuration and scripts for Create React App.",
55
"bugs": {
66
"url": "https://github.com/facebook/create-react-app/issues"

0 commit comments

Comments
 (0)