Skip to content

Commit 9bbc177

Browse files
authored
Remove mjs support (#5027)
* Revert Lerna dependency, there's too many bugs in v3 * Remove `mjs` support
1 parent 7398ee6 commit 9bbc177

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ module.exports = {
142142
// https://github.com/facebook/create-react-app/issues/290
143143
// `web` extension prefixes have been added for better support
144144
// for React Native Web.
145-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
145+
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
146146
alias: {
147147
// @remove-on-eject-begin
148148
// Resolve Babel runtime relative to react-scripts.
@@ -175,7 +175,7 @@ module.exports = {
175175
// First, run the linter.
176176
// It's important to do this before Babel processes the JS.
177177
{
178-
test: /\.(js|jsx|mjs)$/,
178+
test: /\.(js|jsx)$/,
179179
enforce: 'pre',
180180
use: [
181181
{
@@ -214,7 +214,7 @@ module.exports = {
214214
// Process application JS with Babel.
215215
// The preset includes JSX, Flow, and some ESnext features.
216216
{
217-
test: /\.(js|jsx|mjs)$/,
217+
test: /\.(js|jsx)$/,
218218
include: paths.appSrc,
219219
use: [
220220
// This loader parallelizes code compilation, it is optional but
@@ -341,7 +341,7 @@ module.exports = {
341341
// its runtime that would otherwise be processed through "file" loader.
342342
// Also exclude `html` and `json` extensions so they get processed
343343
// by webpacks internal loaders.
344-
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
344+
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
345345
loader: require.resolve('file-loader'),
346346
options: {
347347
name: 'static/media/[name].[hash:8].[ext]',

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module.exports = {
180180
// https://github.com/facebook/create-react-app/issues/290
181181
// `web` extension prefixes have been added for better support
182182
// for React Native Web.
183-
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
183+
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
184184
alias: {
185185
// @remove-on-eject-begin
186186
// Resolve Babel runtime relative to react-scripts.
@@ -213,7 +213,7 @@ module.exports = {
213213
// First, run the linter.
214214
// It's important to do this before Babel processes the JS.
215215
{
216-
test: /\.(js|jsx|mjs)$/,
216+
test: /\.(js|jsx)$/,
217217
enforce: 'pre',
218218
use: [
219219
{
@@ -253,7 +253,7 @@ module.exports = {
253253
// Process application JS with Babel.
254254
// The preset includes JSX, Flow, and some ESnext features.
255255
{
256-
test: /\.(js|jsx|mjs)$/,
256+
test: /\.(js|jsx)$/,
257257
include: paths.appSrc,
258258
use: [
259259
// This loader parallelizes code compilation, it is optional but
@@ -375,7 +375,7 @@ module.exports = {
375375
// it's runtime that would otherwise be processed through "file" loader.
376376
// Also exclude `html` and `json` extensions so they get processed
377377
// by webpacks internal loaders.
378-
exclude: [/\.(js|jsx|mjs)$/, /\.html$/, /\.json$/],
378+
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
379379
options: {
380380
name: 'static/media/[name].[hash:8].[ext]',
381381
},

packages/react-scripts/scripts/utils/createJestConfig.js

+7-15
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,34 @@ module.exports = (resolve, rootDir, isEjecting) => {
2121
// TODO: I don't know if it's safe or not to just use / as path separator
2222
// in Jest configs. We need help from somebody with Windows to determine this.
2323
const config = {
24-
collectCoverageFrom: ['src/**/*.{js,jsx,mjs}'],
24+
collectCoverageFrom: ['src/**/*.{js,jsx}'],
2525
setupFiles: [resolve('config/polyfills.js')],
2626
setupTestFrameworkScriptFile: setupTestsFile,
2727
testMatch: [
28-
'<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}',
29-
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}',
28+
'<rootDir>/src/**/__tests__/**/*.{js,jsx}',
29+
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx}',
3030
],
3131
testEnvironment: 'node',
3232
testURL: 'http://localhost',
3333
transform: {
34-
'^.+\\.(js|jsx|mjs)$': isEjecting
34+
'^.+\\.(js|jsx)$': isEjecting
3535
? '<rootDir>/node_modules/babel-jest'
3636
: resolve('config/jest/babelTransform.js'),
3737
'^.+\\.css$': resolve('config/jest/cssTransform.js'),
3838
'^.+\\.(graphql)$': resolve('config/jest/graphqlTransform.js'),
39-
'^(?!.*\\.(js|jsx|mjs|css|json|graphql)$)': resolve(
39+
'^(?!.*\\.(js|jsx|css|json|graphql)$)': resolve(
4040
'config/jest/fileTransform.js'
4141
),
4242
},
4343
transformIgnorePatterns: [
44-
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$',
44+
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$',
4545
'^.+\\.module\\.(css|sass|scss)$',
4646
],
4747
moduleNameMapper: {
4848
'^react-native$': 'react-native-web',
4949
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
5050
},
51-
moduleFileExtensions: [
52-
'web.js',
53-
'js',
54-
'json',
55-
'web.jsx',
56-
'jsx',
57-
'node',
58-
'mjs',
59-
],
51+
moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx', 'node'],
6052
};
6153
if (rootDir) {
6254
config.rootDir = rootDir;

0 commit comments

Comments
 (0)