Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is not intended to be merged, I just wanted to write my discoveries down while I tried to fix the API docs not generating (see #1894 (comment)).
What I did:
react-docgen-typescript-loader
just did not do anything, and I could for some reason also not set any breakpoints in Next.js 13, so...react-docgen-typescript-loader
(archived, last publish 5y ago) withreact-docgen-typescript-plugin
(not archived, last publish 6 months ago). Looking at the repo it also doesn't really look maintained, so this is probably not the long-term solution anyway, but I just wanted to get the docs to work...webpack
as a dependency, becausereact-docgen-typescript-plugin
tries to load some files that are not available in the precompiled version distributed by nextNo serializer registered for DocGenDependency
, maybe because I had to install webpack and the plugin registered the serializer in the local webpack, not the Next.js bundled webpack. (There supposedly is aNEXT_PRIVATE_LOCAL_WEBPACK
env that should make Next.js use the local webpack, but it didn't work for me, and also isn't available in newer Next.js versions)react-docgen-typescript-plugin
now actually did something, it generated invalid codedefault.__docgenInfo =
which caused Next.js to throwSyntaxError: Unexpected token 'default'
. Somehow the plugin can't figure out component names fromexport default function X()
(there is a somewhat related open issue Invalid JS generated under a certain TS export. Usesdefault
reserved word hipstersmoothie/react-docgen-typescript-plugin#57)visx-annotation
andvisx-demo
packages to instead useexport default X; function X()
, which allows the plugin to get the correct name./docs/annotation
annotation page now compiled and showed docs 🎉, butpropFilter
option used in the loader config doesn't seem available in the pluginJust wanted to write down what I discovered while testing
react-docgen-typescript-plugin
, I'm not sure if this is the best way forward...Some alternatives could be:
react-docgen-typescript-loader
is not working (and maybe fork it)react-docgen-typescript
(which is used by both the loader and the plugin) orreact-docgen
(which also supports typescript via babel) either in a custom webpack plugin or as a prebuild step to generate the docs.react-docgen-typescript
looks equally unmaintained as the plugin andreact-docgen
has 90% blank docs...@williaster and everyone else reading this, I hope this is at least somewhat useful, maybe you have already figured something out anyway. And if you are reading this before the holidays, happy holidays and don't feel compelled to answer until after the holidays :)