# @zooey1184/react-scripts

> Configuration and scripts for Create React App.

Latest version **2.0.2** (published 2020-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zooey1184/react-scripts
pnpm add @zooey1184/react-scripts
yarn add @zooey1184/react-scripts
bun add @zooey1184/react-scripts
```

Provides the command `z-react-scripts`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2020-11-26 |
| First published | 2020-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | ^10.12.0 \|\| >=12.0.0 |
| Dependencies | 60 |
| Unpacked size | 135.6 KB |
| Known vulnerabilities | 0 (+8 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 103222 |
| Maintainers | zooey1184 |

## Links

- npm: https://www.npmjs.com/package/@zooey1184/react-scripts
- Repository: https://github.com/facebook/create-react-app
- Homepage: https://github.com/facebook/create-react-app#readme
- Issues: https://github.com/zooey1184/react-scripts/issues
- npm.io page: https://npm.io/package/@zooey1184/react-scripts

## Dependencies (60)

- [bfj](https://npm.io/package/bfj.md) ^7.0.2
- [jest](https://npm.io/package/jest.md) 26.6.0
- [less](https://npm.io/package/less.md) ^3.12.2
- [dotenv](https://npm.io/package/dotenv.md) 8.2.0
- [eslint](https://npm.io/package/eslint.md) ^7.11.0
- [semver](https://npm.io/package/semver.md) 7.3.2
- [ts-pnp](https://npm.io/package/ts-pnp.md) 1.2.0
- [resolve](https://npm.io/package/resolve.md) 1.18.1
- [webpack](https://npm.io/package/webpack.md) 4.44.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.0.1
- [fsevents](https://npm.io/package/fsevents.md) ^2.1.3
- [camelcase](https://npm.io/package/camelcase.md) ^6.1.0
- [babel-jest](https://npm.io/package/babel-jest.md) ^26.6.0
- [css-loader](https://npm.io/package/css-loader.md) 4.3.0
- [url-loader](https://npm.io/package/url-loader.md) 4.1.1
- [@babel/core](https://npm.io/package/@babel/core.md) 7.12.3
- [file-loader](https://npm.io/package/file-loader.md) 6.1.1
- [jest-circus](https://npm.io/package/jest-circus.md) 26.6.0
- [less-loader](https://npm.io/package/less-loader.md) ^7.0.2
- [sass-loader](https://npm.io/package/sass-loader.md) 8.0.2
- [babel-eslint](https://npm.io/package/babel-eslint.md) ^10.1.0
- [babel-loader](https://npm.io/package/babel-loader.md) 8.1.0
- [jest-resolve](https://npm.io/package/jest-resolve.md) 26.6.0
- [style-loader](https://npm.io/package/style-loader.md) 1.3.0
- [@svgr/webpack](https://npm.io/package/@svgr/webpack.md) 5.4.0
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) 5.1.0
- [react-refresh](https://npm.io/package/react-refresh.md) ^0.8.3
- [postcss-loader](https://npm.io/package/postcss-loader.md) 3.0.0
- [react-dev-utils](https://npm.io/package/react-dev-utils.md) ^11.0.0
- [postcss-normalize](https://npm.io/package/postcss-normalize.md) 8.0.1
- [eslint-plugin-jest](https://npm.io/package/eslint-plugin-jest.md) ^24.1.0
- [identity-obj-proxy](https://npm.io/package/identity-obj-proxy.md) 3.0.0
- [pnp-webpack-plugin](https://npm.io/package/pnp-webpack-plugin.md) 1.6.4
- [postcss-preset-env](https://npm.io/package/postcss-preset-env.md) 6.7.0
- [react-app-polyfill](https://npm.io/package/react-app-polyfill.md) ^2.0.0
- [resolve-url-loader](https://npm.io/package/resolve-url-loader.md) ^3.1.2
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) 3.11.0
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.21.5
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) 4.5.0
- [postcss-safe-parser](https://npm.io/package/postcss-safe-parser.md) 5.0.2
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.22.1
- [jest-watch-typeahead](https://npm.io/package/jest-watch-typeahead.md) 0.6.1
- [eslint-webpack-plugin](https://npm.io/package/eslint-webpack-plugin.md) ^2.1.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) 4.2.3
- [babel-preset-react-app](https://npm.io/package/babel-preset-react-app.md) ^10.0.0
- [eslint-plugin-flowtype](https://npm.io/package/eslint-plugin-flowtype.md) ^5.2.0
- [eslint-plugin-jsx-a11y](https://npm.io/package/eslint-plugin-jsx-a11y.md) ^6.3.1
- [postcss-flexbugs-fixes](https://npm.io/package/postcss-flexbugs-fixes.md) 4.2.1
- [workbox-webpack-plugin](https://npm.io/package/workbox-webpack-plugin.md) 5.1.4
- [eslint-config-react-app](https://npm.io/package/eslint-config-react-app.md) ^6.0.0
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) 0.11.3
- [webpack-manifest-plugin](https://npm.io/package/webpack-manifest-plugin.md) 2.2.0
- [@typescript-eslint/parser](https://npm.io/package/@typescript-eslint/parser.md) ^4.5.0
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^4.2.0
- [eslint-plugin-testing-library](https://npm.io/package/eslint-plugin-testing-library.md) ^3.9.2
- [babel-plugin-named-asset-import](https://npm.io/package/babel-plugin-named-asset-import.md) ^0.3.7
- [@typescript-eslint/eslint-plugin](https://npm.io/package/@typescript-eslint/eslint-plugin.md) ^4.5.0
- [optimize-css-assets-webpack-plugin](https://npm.io/package/optimize-css-assets-webpack-plugin.md) 5.0.4
- [case-sensitive-paths-webpack-plugin](https://npm.io/package/case-sensitive-paths-webpack-plugin.md) 2.3.0
- [@pmmmwh/react-refresh-webpack-plugin](https://npm.io/package/@pmmmwh/react-refresh-webpack-plugin.md) 0.4.2

## Recent versions

- 2.0.2 (latest) — 2020-11-26
- 2.0.1 (beta) — 2020-11-13
- 2.0.0 — 2020-11-13
- 1.4.4 — 2020-08-11
- 1.4.3 — 2020-08-05
- 1.4.2 — 2020-05-26
- 1.4.1 — 2020-05-09
- 1.1.3 — 2020-05-09
- 1.1.2 — 2020-05-09
- 1.1.1 — 2020-02-08
- 1.1.0 — 2020-02-08
- 1.0.6 — 2020-02-08
- 1.0.5 — 2020-02-08
- 1.0.4 — 2020-02-08
- 1.0.3 — 2020-02-07
- … 3 more at https://npm.io/package/@zooey1184/react-scripts/versions

## README

# 对应 react-scripts 版本 4.0.0
>暂不支持react-scripts3.3.0以下的，如果使用create-react-app创建的项目里面react-scripts 版本是3.3.0可能导致版本冲突不能使用z-react-scripts 命令行


|  当前版本 | react-script 对应版本 |
|:-----------:|:---------------------:|
| 1.1.1       |  3.3.1                |
| 1.4.4       |  3.4.1                |
| 2.0.2       |  4.0.0                |


```sh
# 使用方式同react-scripts

"scripts": {
  "start": "z-react-scripts start",
  "build": "z-react-scripts build",
  "test": "z-react-scripts test",
  "eject": "z-react-scripts eject"
}

```
#### 新建文件 react.config.js
> 默认支持less.   (scss支持需要安装node-sass)

目录结构
```sh
my-app
├── README.md
├── node_modules
├── package.json
├── .gitignore
├── react.config.js
├── public
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
└── src
...

```

```js
// react.config.js

const path = require('path')
/**
 * react 个性化配置
 * 注意：不支持异步获取
 * 特别注意 除了 entry 必选配置, 其他都是可选配置
 */
const config = {
  /**
   * 部署应用包时的基本 URL 暂时只配置了生产环境
   * 默认配置 '/'
   * ps: 配置的另外几种方式 process.env.PUBLIC_URL package.json中homepage字段
   */
  publicPath: '/',

  /** 
   * entry: string | object 入口文件配置
   * 如果路径只是到文件夹，则配置自动寻找 index.html  index.js
   * string 文件入口
   * object {path, filename?} path=> 文件夹入口  filename => 最终访问形式
   * filename 默认index.html
   * 可配置多入口 
   * 特别注意如果配置的是多入口  请保证有一个是main的入口  否则不生效
   */
  entry: {
    main: path.join(__dirname, './src/index.js'),
    // a: path.join(__dirname, './src/pages/a/index.js'),
    // a1: {
    //   path: path.join(__dirname, './src/pages/a'),
    //   filename: 'index.html'
    // },
    // b: path.join(__dirname, './src/pages/b'),
  },

  /**
   * resolve:object webpack中resolve配置
   * learn more：https://www.webpackjs.com/configuration/resolve/
   * 暂时只提供alias别名设置
   */
  resolve: {
    /**
     * alias: object 别名设置
     */
    alias: {
      '@': path.join(__dirname, './src')
    }
  },

  /**
   * module: object webpack中module配置
   * learn more: https://www.webpackjs.com/concepts/modules/
   */
  module: {
    /**
     * rules: object[] loader规则配置
     * 默认支持less，sass以及module导入
     * sass需要node>12.0
     * 如果rules 是一个函数 能够让开发者更细粒度的操作rules  需要返回 <ruleLoaders>[]
     */
    rules: []
  },

  /**
   * sourceMap:string
   * 适用 production 环境
   * 是否默认开启sourceMap
   * 可选值："true" || "false"
   */
  sourceMap: 'false',

  /**
   * plugins: []
   * webpack plugins配置
   * 如果之前存在会覆盖原先的配置
   * 默认空数组
   */
  plugins: [],

  /**
   * devServer: object 本地服务配置
   * 暂时开放proxy && port
   */
  devServer: {
    /**
     * port：number || string
     * 端口设置
     * 默认值：3000
     */
    port: 3000,
    /** 
     * proxy: string
     * 同package.json 的proxy字段
     * 可以使用建立setupProxy.js的独立文件配置proxy
     * 需要使用中间件，参数为App 
     */
    // proxy: ''
  },

  /**
   * outputDir: string 打包导出目录
   * 默认 build 文件夹
   */
  outputDir: 'build',
  
  /* 可以使用.babelrc 配置 */
  // useBabelrc: true,

  /* 可以使用babel.config.js */
  // useBabelConfig: true,
}

module.exports = config
```


****
##### react-scripts 说明
This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).<br>
Please refer to its documentation:

- [Getting Started](https://facebook.github.io/create-react-app/docs/getting-started) – How to create a new app.
- [User Guide](https://facebook.github.io/create-react-app/) – How to develop apps bootstrapped with Create React App.

修改原文件
path
webpack.config.js
+ dealConfig.js

---
_Source: https://npm.io/package/@zooey1184/react-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
