react-docgen-typescript-loader
react-docgen-typescript-loader copied to clipboard
Props aren't being shown when components are in node_modules
I have two repositories, one containing my storybook which loads a compiled version of another repository as a part of node_modules.
The dependency is compiled to commonjs and generates a bunch of .d.ts and .js files.
This is what my webpack.config looks like:
const path = require("path");
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve("awesome-typescript-loader")
}
]
});
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: require.resolve("react-docgen-typescript-loader"),
options: {
tsconfigPath: path.resolve(__dirname, '../tsconfig.json')
}
}
],
include: path.resolve(__dirname, '../node_modules/@repo2')
});
config.resolve.extensions.push(".ts", ".tsx");
return config;
};
Are there transformations I need to apply to repo2? Or am I missing some configuration?
Hi, I have the same issue. Sample project is here: https://github.com/aviraminy/storybook-template-mono-repo
I suspect this is related to #100 as it seems that node_modules/ is excluded by TypeScript by default:
The "exclude" property defaults to excluding the node_modules, bower_components, jspm_packages and <outDir> directories when not specified.
- https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
See also: https://www.typescriptlang.org/v2/tsconfig#exclude
Possibly you could avoid this by explicitly setting exclude in your tsconfig but that might have unintended consequences.