-
Notifications
You must be signed in to change notification settings - Fork 33
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
Imported Components do not work #36
Comments
See over in #37 ... this might be caused by storybook-router having a problem with imports from 'react-router-dom'. (You didn't show your import in your top file... but I'm guessing that's what you did, since that is what react-router's docs recommend.) |
In my case, The solution is create an alias inside babel config to resolve {
"presets": [...],
"plugins": [
...
[
"babel-plugin-module-resolver",
{
"alias": {
"react-router-dom": "./node_modules/react-router-dom",
"react-router": "./node_modules/react-router"
}
}
],
]
} And use this babel config in Webpack loader (configured inside webpackFinal: (config) => {
config.module.rules.push({
test: /\.jsx?$/,
use: [
{
loader: 'babel-loader',
options: {
configFile: path.resolve(__dirname, '.babelrc'),
},
},
],
include: 'my-own-module-path',
});
return config;
} |
Issue:
Which version are you using?
"storybook-react-router": "^1.0.5",
Are you using storybook-router with a react based project or a vue one?
React
Please describe the problem:
We are importing a React component from another library that uses links and a switch. In its basic form it looks like this:
However it seems as though StoryRouter is completely unable to understand this component as my console is filled with invariant errors complaining that Link and Switch should not be used outisde of a Router.
Our story looks like this:
The example all include the components within the story file itself so its hard to determine what is causing this. I have also tried disabling all other storybook extensions that were not relevant to this without avail. Can this plugin not support typescript or external components?
The text was updated successfully, but these errors were encountered: