Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/happy-tools-agree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@channel.io/bezier-react": patch
---

Replace `@channel.io/react-docgen-typescript-plugin` with Storybook's `reactDocgen` option
28 changes: 8 additions & 20 deletions packages/bezier-react/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const ReactDocgenTypescriptPlugin = require('@channel.io/react-docgen-typescript-plugin').default
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')

module.exports = {
Expand All @@ -23,13 +22,15 @@ module.exports = {
typescript: {
/**
* @note
*
* default `typescript.reactDocgen` option is to use `react-docgen-typescript-plugin`,
* which is not compatible with TS <= 4.3
*
* so we need to disable and override it with our own plugin (@channel-io/react-docgen-typescript-plugin).
*
* `react-docgen-typescript-plugin` introduces significant overhead
* when HMR is enabled, so we enable it only in production.
*/
reactDocgen: false,
reactDocgen: process.env.NODE_ENV === 'production' && 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
webpackFinal: async (config) => {
// Apply tsconfig alias path
Expand All @@ -48,19 +49,6 @@ module.exports = {

config.resolve.extensions.push('.ts', '.tsx')

if (process.env.NODE_ENV === 'production') {
/**
* @note
*
* `react-docgen-typescript-plugin` introduces significant overhead
* when HMR is enabled, so we enable it only in production.
*/
config.plugins.push(new ReactDocgenTypescriptPlugin({
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
}))
}

return config
}
}
1 change: 0 additions & 1 deletion packages/bezier-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@channel.io/bezier-icons": "^0.10.0",
"@channel.io/react-docgen-typescript-plugin": "^1.0.0",
"@mdx-js/react": "^1.6.22",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-babel": "^6.0.3",
Expand Down
Loading