Skip to content

Commit 056b160

Browse files
committed
Add babel-plugin-react-display-name. Should preserve displayName when using React.createComponent. Fix #18.
1 parent 2935eca commit 056b160

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"dependencies": {
3131
"babel-core": "5.8.30",
3232
"babel-loader": "5.3.2",
33+
"babel-plugin-react-display-name": "~2.0.0",
3334
"babel-plugin-react-transform": "1.1.1",
3435
"chalk": "1.1.1",
3536
"codemirror": "5.8.0",

src/make-webpack-config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ module.exports = function(env) {
1717
}
1818

1919
var reactTransformPath = path.join(__dirname, '../../babel-plugin-react-transform'); // npm 3
20+
var reactDisplayNamePath = path.join(__dirname, '../../babel-plugin-react-display-name'); // npm 3
2021
if (!fs.existsSync(reactTransformPath)) {
2122
reactTransformPath = path.resolve(__dirname, '../node_modules/babel-plugin-react-transform'); // npm 2 or react-styleguidist develop
23+
reactDisplayNamePath = path.resolve(__dirname, '../node_modules/babel-plugin-react-display-name'); // npm 2 or react-styleguidist develop
2224
}
2325

2426
var includes = [
@@ -146,7 +148,10 @@ module.exports = function(env) {
146148
loader: 'babel',
147149
query: {
148150
stage: 0,
149-
plugins: [reactTransformPath],
151+
plugins: [
152+
reactDisplayNamePath,
153+
reactTransformPath
154+
],
150155
extra: {
151156
'react-transform': {
152157
transforms: [

0 commit comments

Comments
 (0)