-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot import component from React lib into Markdown (docusaurus) #112
Comments
I tried importing a React javascript component with a relative path and it rendered correctly. I don't think Docusaurus supports rendering typescript React components in |
Thanks @ZachJW34 for your response - good information. I will look into the options you suggest and report back. We looked quite a bit at Storybook. The feeling is that Storybook is more geared to internal documentation while we prefer Docusaurus for customer-facing docs. So we are trying to get the best of both worlds - good developer experience for components and when writing documentation, plus nice customer-facing packaged docs. |
@ZachJW34 your suggestion to use For interest my
Closing this issue - thanks for your help! |
Glad it worked out! |
I have tried the method above and I don't think it is working any longer: const tsconfig = require('../../tsconfig.base.json');
const paths = tsconfig.compilerOptions.paths;
const alias = Object.keys(paths).reduce(
(aliases, k) => ({ ...aliases, [k]: './' + paths[k][0] }),
{}
);
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
alias: alias,
},
],
],
}; It results in errors like this:
|
I've tried the workaround but it adds too much My structure is
i've add as follow on my nuxt config: build: {
babel: {
plugins: [
[
require.resolve('babel-plugin-module-resolver'),
{
alias,
},
],
],
},
}, my path alias is
|
Current Behavior
Apologies if this has been covered somewhere but I couldn't find it. I'm expecting to be able to import the components to document into Markdown in order to show their behaviour. The components will be in various libs within the NX project developed in Typescript. And apologies if this is not a bug, it just seems the way it should work!
I added the following to my markdown:
Error on render:
Expected Behavior
Component imported and displayed.
Steps to Reproduce
Then I edited
doc2.md
as shown above.Environment
Plugin name and version: 10.0.0
The text was updated successfully, but these errors were encountered: