Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6526e06

Browse files
update react-scripts package from 3.3.0 to 3.4.0
1 parent 8b0dd54 commit 6526e06

File tree

7 files changed

+344
-7
lines changed

7 files changed

+344
-7
lines changed

‎README.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# :warning: WARNING!
2+
3+
This is a custom scripts-version of React-Scripts that provides Monorepo support.
4+
5+
See [React Workspaces Playground](https://github.com/react-workspaces/react-workspaces-playground) for a working demo.
6+
7+
[![React Workspaces Playground Screenshots](https://i.imgur.com/7snWXD0.png)](https://github.com/react-workspaces/react-workspaces-playground)
8+
9+
For more information on why this was created, please read this for more info: [Support Lerna and/or Yarn Workspaces #1333](https://github.com/facebook/create-react-app/issues/1333)
10+
111
# Create React App [![Build Status](https://dev.azure.com/facebook/create-react-app/_apis/build/status/facebook.create-react-app?branchName=master)](https://dev.azure.com/facebook/create-react-app/_build/latest?definitionId=1&branchName=master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://github.com/facebook/create-react-app/blob/master/CONTRIBUTING.md)
212

313
Create React apps with no build configuration.
@@ -16,6 +26,7 @@ npx create-react-app my-app
1626
cd my-app
1727
npm start
1828
```
29+
1930
If you've previously installed `create-react-app` globally via `npm install -g create-react-app`, we recommend you uninstall the package using `npm uninstall -g create-react-app` to ensure that npx always uses the latest version.
2031

2132
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_

‎packages/react-scripts/README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# :warning: WARNING!
2+
3+
This is a custom scripts-version of React-Scripts that provides Monorepo support.
4+
5+
See [React Workspaces Playground](https://github.com/react-workspaces/react-workspaces-playground) for a working demo.
6+
7+
[![React Workspaces Playground Screenshots](https://i.imgur.com/7snWXD0.png)](https://github.com/react-workspaces/react-workspaces-playground)
8+
9+
For more information on why this ways created, please read this for more info: https://github.com/F1LT3R/cra-workspaces-support-1333
10+
111
# react-scripts
212

313
This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).<br>

‎packages/react-scripts/config/paths.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
const path = require('path');
1212
const fs = require('fs');
13+
const findUp = require('find-up');
1314
const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
1415

1516
// Make sure any symlinks in the project folder are resolved:
@@ -103,7 +104,9 @@ module.exports = {
103104
};
104105

105106
const ownPackageJson = require('../package.json');
106-
const reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
107+
const reactScriptsPath = findUp.sync(`node_modules/${ownPackageJson.name}`, {
108+
cwd: resolveApp('.'),
109+
});
107110
const reactScriptsLinked =
108111
fs.existsSync(reactScriptsPath) &&
109112
fs.lstatSync(reactScriptsPath).isSymbolicLink();

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
2828
const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent');
2929
const paths = require('./paths');
3030
const modules = require('./modules');
31+
const yarnWorkspaces = require('./yarn-workspaces');
3132
const getClientEnvironment = require('./env');
3233
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
3334
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
@@ -59,12 +60,35 @@ const cssModuleRegex = /\.module\.css$/;
5960
const sassRegex = /\.(scss|sass)$/;
6061
const sassModuleRegex = /\.module\.(scss|sass)$/;
6162

63+
const workspacesConfig = yarnWorkspaces.init(paths);
64+
6265
// This is the production and development configuration.
6366
// It is focused on developer experience, fast rebuilds, and a minimal bundle.
6467
module.exports = function(webpackEnv) {
6568
const isEnvDevelopment = webpackEnv === 'development';
6669
const isEnvProduction = webpackEnv === 'production';
6770

71+
const workspacesMainFields = [
72+
workspacesConfig.packageEntry,
73+
'browser',
74+
'module',
75+
'main',
76+
];
77+
78+
const mainFields =
79+
isEnvDevelopment && workspacesConfig.development
80+
? workspacesMainFields
81+
: isEnvProduction && workspacesConfig.production
82+
? workspacesMainFields
83+
: undefined;
84+
85+
const includePaths =
86+
isEnvDevelopment && workspacesConfig.development
87+
? [paths.appSrc, ...workspacesConfig.paths]
88+
: isEnvProduction && workspacesConfig.production
89+
? [paths.appSrc, ...workspacesConfig.paths]
90+
: paths.appSrc;
91+
6892
// Variable used for enabling profiling in Production
6993
// passed into alias object. Uses a flag if passed into the build command
7094
const isEnvProductionProfile =
@@ -297,6 +321,7 @@ module.exports = function(webpackEnv) {
297321
extensions: paths.moduleFileExtensions
298322
.map(ext => `.${ext}`)
299323
.filter(ext => useTypeScript || !ext.includes('ts')),
324+
mainFields,
300325
alias: {
301326
// Support React Native Web
302327
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -373,7 +398,7 @@ module.exports = function(webpackEnv) {
373398
loader: require.resolve('eslint-loader'),
374399
},
375400
],
376-
include: paths.appSrc,
401+
include: includePaths,
377402
},
378403
{
379404
// "oneOf" will traverse all following loaders until one will
@@ -395,7 +420,7 @@ module.exports = function(webpackEnv) {
395420
// The preset includes JSX, Flow, TypeScript, and some ESnext features.
396421
{
397422
test: /\.(js|mjs|jsx|ts|tsx)$/,
398-
include: paths.appSrc,
423+
include: includePaths,
399424
loader: require.resolve('babel-loader'),
400425
options: {
401426
customize: require.resolve(
@@ -692,6 +717,10 @@ module.exports = function(webpackEnv) {
692717
typescript: resolve.sync('typescript', {
693718
basedir: paths.appNodeModules,
694719
}),
720+
compilerOptions: {
721+
skipLibCheck: true,
722+
suppressOutputPathCheck: true,
723+
},
695724
async: isEnvDevelopment,
696725
useTypescriptIncrementalApi: true,
697726
checkSyntacticErrors: true,
@@ -709,6 +738,7 @@ module.exports = function(webpackEnv) {
709738
'!**/src/setupProxy.*',
710739
'!**/src/setupTests.*',
711740
],
741+
watch: includePaths,
712742
silent: true,
713743
// The formatter is invoked directly in WebpackDevServerUtils during development
714744
formatter: isEnvProduction ? typescriptFormatter : undefined,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /