Skip to content

Commit

Permalink
Remove mjs support (#5027)
Browse files Browse the repository at this point in the history
* Revert Lerna dependency, there's too many bugs in v3

* Remove `mjs` support
  • Loading branch information
Timer authored Sep 18, 2018
1 parent 7398ee6 commit 9bbc177
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
8 changes: 4 additions & 4 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ module.exports = {
// https://github.com/facebook/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// @remove-on-eject-begin
// Resolve Babel runtime relative to react-scripts.
Expand Down Expand Up @@ -175,7 +175,7 @@ module.exports = {
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|jsx|mjs)$/,
test: /\.(js|jsx)$/,
enforce: 'pre',
use: [
{
Expand Down Expand Up @@ -214,7 +214,7 @@ module.exports = {
// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.(js|jsx|mjs)$/,
test: /\.(js|jsx)$/,
include: paths.appSrc,
use: [
// This loader parallelizes code compilation, it is optional but
Expand Down Expand Up @@ -341,7 +341,7 @@ module.exports = {
// 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|jsx|mjs)$/, /\.html$/, /\.json$/],
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
loader: require.resolve('file-loader'),
options: {
name: 'static/media/[name].[hash:8].[ext]',
Expand Down
8 changes: 4 additions & 4 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ module.exports = {
// https://github.com/facebook/create-react-app/issues/290
// `web` extension prefixes have been added for better support
// for React Native Web.
extensions: ['.web.js', '.mjs', '.js', '.json', '.web.jsx', '.jsx'],
extensions: ['.web.js', '.js', '.json', '.web.jsx', '.jsx'],
alias: {
// @remove-on-eject-begin
// Resolve Babel runtime relative to react-scripts.
Expand Down Expand Up @@ -213,7 +213,7 @@ module.exports = {
// First, run the linter.
// It's important to do this before Babel processes the JS.
{
test: /\.(js|jsx|mjs)$/,
test: /\.(js|jsx)$/,
enforce: 'pre',
use: [
{
Expand Down Expand Up @@ -253,7 +253,7 @@ module.exports = {
// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
test: /\.(js|jsx|mjs)$/,
test: /\.(js|jsx)$/,
include: paths.appSrc,
use: [
// This loader parallelizes code compilation, it is optional but
Expand Down Expand Up @@ -375,7 +375,7 @@ module.exports = {
// it's 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|jsx|mjs)$/, /\.html$/, /\.json$/],
exclude: [/\.(js|jsx)$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
Expand Down
22 changes: 7 additions & 15 deletions packages/react-scripts/scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,34 @@ module.exports = (resolve, rootDir, isEjecting) => {
// TODO: I don't know if it's safe or not to just use / as path separator
// in Jest configs. We need help from somebody with Windows to determine this.
const config = {
collectCoverageFrom: ['src/**/*.{js,jsx,mjs}'],
collectCoverageFrom: ['src/**/*.{js,jsx}'],
setupFiles: [resolve('config/polyfills.js')],
setupTestFrameworkScriptFile: setupTestsFile,
testMatch: [
'<rootDir>/src/**/__tests__/**/*.{js,jsx,mjs}',
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx,mjs}',
'<rootDir>/src/**/__tests__/**/*.{js,jsx}',
'<rootDir>/src/**/?(*.)(spec|test).{js,jsx}',
],
testEnvironment: 'node',
testURL: 'http://localhost',
transform: {
'^.+\\.(js|jsx|mjs)$': isEjecting
'^.+\\.(js|jsx)$': isEjecting
? '<rootDir>/node_modules/babel-jest'
: resolve('config/jest/babelTransform.js'),
'^.+\\.css$': resolve('config/jest/cssTransform.js'),
'^.+\\.(graphql)$': resolve('config/jest/graphqlTransform.js'),
'^(?!.*\\.(js|jsx|mjs|css|json|graphql)$)': resolve(
'^(?!.*\\.(js|jsx|css|json|graphql)$)': resolve(
'config/jest/fileTransform.js'
),
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$',
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
moduleNameMapper: {
'^react-native$': 'react-native-web',
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',
},
moduleFileExtensions: [
'web.js',
'js',
'json',
'web.jsx',
'jsx',
'node',
'mjs',
],
moduleFileExtensions: ['web.js', 'js', 'json', 'web.jsx', 'jsx', 'node'],
};
if (rootDir) {
config.rootDir = rootDir;
Expand Down

0 comments on commit 9bbc177

Please # to comment.