1 | # react-scripts
|
2 |
|
3 | This package includes scripts and configuration used by [Create React App](https://github.com/facebook/create-react-app).<br>
|
4 | Please refer to its documentation:
|
5 |
|
6 | - [Getting Started](https://github.com/facebook/create-react-app/blob/master/README.md#getting-started) – How to create a new app.
|
7 | - [User Guide](https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App.
|
8 |
|
9 | # Configuration & Plugin Support (unofficial)
|
10 |
|
11 | This is an unofficial fork that extends Create React App with an interface for plugins and custom config.
|
12 |
|
13 | If a `cra.config.js` plugin doesn't exist, there's no difference than if you were using the official package.
|
14 |
|
15 | ## Configuration
|
16 |
|
17 | An ES5 module exported by `cra.config.js` at the app's root is used for configuration. Each property is optional.
|
18 |
|
19 | | Property | Type | Description |
|
20 | | --------- | --------------------- | ------------------------------------------ |
|
21 | | [plugins] | <code>array</code> | plugin references or names. default: `[]` |
|
22 | | [apply] | <code>function</code> | webpack config. default: identity function |
|
23 | | [babel] | <code>function</code> | babel config. default: identity function |
|
24 |
|
25 | ### Example
|
26 |
|
27 | ```js
|
28 | module.exports = {
|
29 | // Load plugins by name and/or by reference. Loading plugins by name is for
|
30 | // convenience, eg. `'css-modules'` is the same as `require('react-scripts-plugin-css-modules')`
|
31 | plugins: ['no-minify', require('./my-internal-plugin')],
|
32 |
|
33 | // Webpack configuration
|
34 | apply: (config, { env, paths }) => {
|
35 | return config;
|
36 | },
|
37 |
|
38 | // Babel configuration
|
39 | babel: (config, { env, paths }) => {
|
40 | return config;
|
41 | },
|
42 | };
|
43 | ```
|
44 |
|
45 | ## Plugins
|
46 |
|
47 | A plugin is simply an exported custom config _without_ the `plugins` property.
|
48 |
|
49 | ## Available Plugins
|
50 |
|
51 | - [react-scripts-plugin-babelrc](https://www.npmjs.com/package/react-scripts-plugin-babelrc)
|
52 | - [react-scripts-plugin-no-hashes](https://www.npmjs.com/package/react-scripts-plugin-no-hashes)
|
53 | - [react-scripts-plugin-no-minify](https://www.npmjs.com/package/react-scripts-plugin-no-minify)
|
54 | - [react-scripts-plugin-sentry](https://www.npmjs.com/package/react-scripts-plugin-sentry)
|