Skip to content

Commit

Permalink
fix(docz-plugin-babel6): props parsing when typescript is enable
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronauck committed Jul 11, 2018
1 parent 21bd8c5 commit 0564bdf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/docz-plugin-babel6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"babel-preset-react-app": "^3.1.2",
"docz-core": "^0.5.6",
"happypack": "^5.0.0",
"react-docgen-typescript-loader": "^2.1.1",
"ts-loader": "^4.4.2"
}
}
11 changes: 10 additions & 1 deletion packages/docz-plugin-babel6/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const babel = () =>

return babelrc
},
modifyBundlerConfig: config => {
modifyBundlerConfig: (config, dev, args) => {
const happypackJsx = config.plugins.findIndex(findHappypackJsx)
const happypackMdx = config.plugins.findIndex(findHappypackMdx)
const tsxRule = config.module.rules.find(findTsxRule)
Expand All @@ -36,6 +36,8 @@ export const babel = () =>
modifyHappypackLoader(config.plugins[happypackJsx])
modifyHappypackLoader(config.plugins[happypackMdx])

console.log(args)

if (tsxRule) {
config.module.rules[tsxIdx] = {
...tsxRule,
Expand All @@ -52,6 +54,13 @@ export const babel = () =>
happyPackMode: true,
},
},
...(args.propsParser
? [
{
loader: require.resolve('react-docgen-typescript-loader'),
},
]
: []),
],
})
)
Expand Down

0 comments on commit 0564bdf

Please sign in to comment.