1
-
1
+
2
2
[ ![ npm version] ( https://img.shields.io/npm/v/react-app-rewired.svg )] ( https://www.npmjs.com/package/react-app-rewired )
3
3
[ ![ npm monthly downloads] ( https://img.shields.io/npm/dm/react-app-rewired.svg )] ( https://www.npmjs.com/package/react-app-rewired )
4
-
4
+
5
5
<img alt =" react-app-rewired " src =" https://github.com/timarney/react-app-rewired/raw/master/assets/react-app-rewired.png " />
6
6
7
7
# Rewire Your App
@@ -73,7 +73,7 @@ $ npm run build
73
73
```
74
74
75
75
76
- ## Utilities
76
+ ## Utilities
77
77
78
78
#### 1) injectBabelPlugin
79
79
@@ -88,25 +88,25 @@ const {injectBabelPlugin} = require('react-app-rewired');
88
88
module .exports = function override (config , env ) {
89
89
// add a plugin
90
90
config = injectBabelPlugin (' emotion/babel' ,config)
91
-
91
+
92
92
// use the Preact rewire
93
93
if (env === " production" ) {
94
94
console .log (" ⚡ Production build with Preact" );
95
95
config = rewirePreact (config, env);
96
96
}
97
-
97
+
98
98
// use the MobX rewire
99
99
config = rewireMobX (config,env);
100
-
100
+
101
101
return config;
102
102
}
103
103
```
104
104
105
105
#### 2) compose(after v1.3.4)
106
106
107
107
You can use this util to compose rewires.
108
- > A functional programming utility, performs ` right-to-left ` function composition.
109
- More detail you can see [ ramda] ( http://ramdajs.com/docs/#compose ) or [ redux] ( http://redux.js.org/docs/api/compose.html#composefunctions )
108
+ > A functional programming utility, performs ` right-to-left ` function composition.
109
+ More detail you can see [ ramda] ( http://ramdajs.com/docs/#compose ) or [ redux] ( http://redux.js.org/docs/api/compose.html#composefunctions )
110
110
111
111
Before:
112
112
``` javascript
@@ -115,7 +115,7 @@ module.exports = function override(config, env) {
115
115
config = rewireLess (config, env);
116
116
config = rewirePreact (config, env);
117
117
config = rewireMobX (config, env);
118
-
118
+
119
119
return config;
120
120
}
121
121
```
@@ -130,7 +130,7 @@ module.exports = compose(
130
130
rewireMobx
131
131
...
132
132
)
133
- // custom config
133
+ // custom config
134
134
module .exports = function (config , env ){
135
135
const rewires = compose (
136
136
rewireLess,
@@ -143,11 +143,11 @@ module.exports = function(config, env){
143
143
return rewires (config, env);
144
144
}
145
145
```
146
- Some change with rewire, if you want to add some ` extra param ` for ` rewire `
147
- 1 . Optional params:
148
- you can see [ react-app-rewire-less] ( https://github.com/timarney/react-app-rewired/blob/master/packages/react-app-rewire-less/index.js )
146
+ Some change with rewire, if you want to add some ` extra param ` for ` rewire `
147
+ 1 . Optional params:
148
+ you can see [ react-app-rewire-less] ( https://github.com/timarney/react-app-rewired/blob/master/packages/react-app-rewire-less/index.js )
149
149
150
- 2 . Required params:
150
+ 2 . Required params:
151
151
``` javascript
152
152
// rewireSome.js
153
153
function createRewire (requiredParams ){
@@ -343,6 +343,7 @@ If you need to change the location of your config-overrides.js you can pass a co
343
343
* [ react-app-rewire-babel-loader] ( https://github.com/dashed/react-app-rewire-babel-loader ) by [ @dashed ] ( https://github.com/dashed )
344
344
* [ react-app-rewire-svgr] ( https://github.com/gitim/react-app-rewire-svgr ) by [ @gitim ] ( https://github.com/gitim )
345
345
* [ react-app-rewire-yaml] ( https://github.com/hsz/react-app-rewire-yaml ) by [ @hsz ] ( https://github.com/hsz )
346
+ * [ react-app-rewire-scss] ( https://github.com/aze3ma/react-app-rewire-scss ) by [ @aze3ma ] ( https://github.com/aze3ma )
346
347
347
348
## Other
348
349
0 commit comments