File tree 8 files changed +5373
-2436
lines changed
8 files changed +5373
-2436
lines changed Original file line number Diff line number Diff line change 3
3
"version" : " 0.1.0" ,
4
4
"private" : true ,
5
5
"dependencies" : {
6
- "babel- plugin-transform -decorators-legacy " : " ^1.3.4 " ,
7
- "monkey-react-scripts" : " 0.1.1 " ,
8
- "node-sass" : " ^4.7.2 " ,
6
+ "@ babel/ plugin-proposal -decorators" : " ^7.1.0 " ,
7
+ "monkey-react-scripts" : " 0.1.2 " ,
8
+ "node-sass" : " ^4.9.3 " ,
9
9
"postcss-inline-rtl" : " ^0.9.8" ,
10
- "react" : " ^16.2.0" ,
11
- "react-dom" : " ^16.2.0" ,
12
- "react-scripts" : " 1.1.4" ,
13
- "sass-loader" : " ^7.1.0" ,
10
+ "react" : " ^16.5.2" ,
11
+ "react-dom" : " ^16.5.2" ,
12
+ "react-scripts" : " 2.0.3" ,
14
13
"webpack-visualizer-plugin" : " ^0.1.11"
15
14
},
16
15
"scripts" : {
17
16
"start" : " monkey-react-scripts start" ,
18
17
"build" : " monkey-react-scripts build" ,
19
18
"test" : " monkey-react-scripts test --env=jsdom"
20
- }
19
+ },
20
+ "browserslist" : [
21
+ " >0.2%" ,
22
+ " not dead" ,
23
+ " not ie <= 11" ,
24
+ " not op_mini all"
25
+ ]
21
26
}
Original file line number Diff line number Diff line change @@ -16,10 +16,12 @@ function withRedBorder(Cmp) {
16
16
}
17
17
18
18
@withRedBorder
19
- export class Sample extends Component {
19
+ class Sample extends Component {
20
20
render ( ) {
21
21
return ( < div > Sample With Decorator</ div > )
22
22
}
23
23
}
24
24
25
25
Sample . propTypes = { }
26
+
27
+ export { Sample }
Original file line number Diff line number Diff line change @@ -3,8 +3,11 @@ const {findRule} = require('./utils');
3
3
module . exports . babelPatch = function babelPatch ( webpackConfig , isDevelopment ) {
4
4
// find babel rule
5
5
const babelRule = findRule ( webpackConfig , ( rule ) => {
6
- return ( '' + rule . test === '' + / \. ( j s | j s x | m j s ) $ / )
6
+ return ( '' + rule . test === '' + / \. ( j s | j s x ) $ / )
7
7
} ) ;
8
8
const plugins = babelRule . options . plugins || [ ] ;
9
- babelRule . options . plugins = [ ...plugins , 'transform-decorators-legacy' ]
9
+ babelRule . options . plugins = [
10
+ ...plugins ,
11
+ [ "@babel/plugin-proposal-decorators" , { legacy : true } ] ,
12
+ ]
10
13
} ;
Original file line number Diff line number Diff line change
1
+ const { findRules} = require ( './utils' )
2
+
3
+ module . exports . cssPatch = function cssPatch ( webpackConfig , isDevelopment ) {
4
+ const cssRules = findRules ( webpackConfig , ( rule ) => {
5
+ return (
6
+ '' + rule . test === '' + / \. c s s $ / ||
7
+ '' + rule . test === '' + / \. m o d u l e \. c s s $ / ||
8
+ '' + rule . test === '' + / \. ( s c s s | s a s s ) $ / ||
9
+ '' + rule . test === '' + / \. m o d u l e \. ( s c s s | s a s s ) $ /
10
+ )
11
+ } ) ;
12
+
13
+ cssRules . forEach ( ( cssRule ) => {
14
+ const cssLoaders = isDevelopment ? cssRule . use : cssRule . loader
15
+ cssLoaders . forEach ( ( loader ) => {
16
+ if ( loader . options && loader . options . ident === 'postcss' ) {
17
+ const postCssLoader = loader
18
+ const postCssFunction = postCssLoader . options . plugins
19
+ postCssLoader . options . plugins = ( ) => {
20
+ return [ ...postCssFunction ( ) , require ( 'postcss-inline-rtl' ) ]
21
+ }
22
+ }
23
+ } ) ;
24
+ } ) ;
25
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
module . exports . findRule = function findRule ( webpackConfig , callback ) {
2
- const rules = webpackConfig . module . rules [ 1 ] . oneOf ;
2
+ const rules = webpackConfig . module . rules [ 3 ] . oneOf ;
3
3
const index = rules . findIndex ( callback ) ;
4
4
if ( index === - 1 ) throw Error ( 'Loader not found' ) ;
5
5
return rules [ index ]
6
6
} ;
7
7
8
- module . exports . addRule = function addRule ( webpackConfig , rule ) {
8
+ module . exports . findRules = function findRule ( webpackConfig , callback ) {
9
+ const rules = webpackConfig . module . rules [ 3 ] . oneOf ;
10
+ return rules . filter ( callback ) ;
11
+ } ;
12
+
13
+ module . exports . addRule = function addRule ( webpackConfig , rule ) {
9
14
const rules = webpackConfig . module . rules [ 1 ] . oneOf
10
15
rules . splice ( rules . length - 1 , 0 , rule ) // add before exclude rule
11
16
}
Original file line number Diff line number Diff line change 1
1
const { pluginsPatch} = require ( './webpack-helpers/pluginsPatch' ) ;
2
2
const { babelPatch} = require ( './webpack-helpers/babelPatch' ) ;
3
- const { sassPatch } = require ( './webpack-helpers/sassPatch ' ) ;
3
+ const { cssPatch } = require ( './webpack-helpers/cssPatch ' ) ;
4
4
5
5
module . exports = function ( webpackConfig , isDevelopment ) {
6
6
pluginsPatch ( webpackConfig , isDevelopment )
7
7
babelPatch ( webpackConfig , isDevelopment )
8
- sassPatch ( webpackConfig , isDevelopment )
8
+ cssPatch ( webpackConfig , isDevelopment )
9
9
} ;
You can’t perform that action at this time.
0 commit comments