@@ -70,18 +70,52 @@ build
7070│ └── logo.5d5d9eef.svg
7171└── stats.html <-- new file
7272```
73+ ### Decorator support
74+ If you love decorators, you can add decorator support:
75+ - install decorator plugin
76+ ```
77+ npm install --save-dev babel-plugin-transform-decorators-legacy
78+ ```
79+ - edit ` webpack.monkey.js ` like this:
80+ ``` js
81+ function findLoader (config , callback ) {
82+ var index = config .module .loaders .findIndex (callback);
83+ if (index === - 1 ) throw Error (' Loader not found' );
84+ return config .module .loaders [index];
85+ }
86+
87+ function addBabelPlugins (webpackConfig , plugins ) {
88+ var babelLoader = findLoader (webpackConfig, function (loader ) {
89+ return loader .loader === ' babel'
90+ });
91+ babelLoader .query .plugins = (babelLoader .query .plugins || []).concat (plugins);
92+ }
7393
94+ module .exports = function (webpackConfig , isDevelopment ) {
95+ addBabelPlugins (webpackConfig, [
96+ require .resolve (' babel-plugin-transform-decorators-legacy' )
97+ ]);
98+ };
99+ ```
100+ related issues: [ #107 ] [ 107 ] , [ #167 ] [ 167 ] , [ #214 ] [ 214 ] , [ #309 ] [ 309 ] , [ #411 ] [ 411 ] , [ #1357 ] [ 1357 ]
74101## TODOs
75102- [ ] add helpers
76103- [ ] customize test runner (jest)
77104- [ ] add more example
78105 - [ ] scss support
79- - [ ] decorator support
106+ - [x ] decorator support
80107 - [ ] relay support
81108
82109## Thanks
83110@svrcekmichal for [ configurable-react-scripts] [ configurable-react-scripts ]
84111
85112[ create-react-app ] : https://github.com/facebookincubator/create-react-app#tldr
86113[ webpack-visualizer ] : https://github.com/chrisbateman/webpack-visualizer
87- [ configurable-react-scripts ] : https://github.com/svrcekmichal/configurable-react-scripts
114+ [ configurable-react-scripts ] : https://github.com/svrcekmichal/configurable-react-scripts
115+
116+ [ 107 ] : https://github.com/facebookincubator/create-react-app/issues/107
117+ [ 167 ] : https://github.com/facebookincubator/create-react-app/issues/167
118+ [ 214 ] : https://github.com/facebookincubator/create-react-app/issues/214
119+ [ 309 ] : https://github.com/facebookincubator/create-react-app/issues/309
120+ [ 411 ] : https://github.com/facebookincubator/create-react-app/issues/411
121+ [ 1357 ] : https://github.com/facebookincubator/create-react-app/issues/1357
0 commit comments