-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
…." error in Link story (possibly other stories using links as well)
@@ -123,6 +122,7 @@ | |||
"webpack-node-externals": "^1.5.4" | |||
}, | |||
"dependencies": { | |||
"@kadira/storybook": "^2.21.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required by changes in storybook/rr.js and storybook/webpack.config.js
@@ -1,7 +1,7 @@ | |||
import React from 'react' | |||
import { List, ListItem } from 'material-ui/List' | |||
import Divider from 'material-ui/Divider' | |||
import { Link } from 'react-router' | |||
import Link from 'components/Link' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes in this file were done mostly to test using link in another component. I can drop the changes in this file if you wish.
storybook/webpack.config.js
Outdated
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried adding the loaders to the config, but they produce errors. I don't see where could they be needed. Are they needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly doesn't work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running the storybook. A lot of Module build failed: Unknown word
errors appear.
This is the code I use to add the loaders:
newConfig.module.loaders.push({
test: /\.css$/,
loader: 'style!css?localIdentName=[local]___[hash:base64:5]',
})
newConfig.module.loaders.push({
test: /\.png$/,
loader: 'url-loader',
query: { mimetype: 'image/png' },
})
storybook/webpack.config.js
Outdated
|
||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly doesn't work?
storybook/webpack.config.js
Outdated
// This is just the basic way to add addional webpack configurations. | ||
// For more information refer the docs: https://goo.gl/qPbSyX | ||
// load the default config generator. | ||
const genDefaultConfig = require('@kadira/storybook/dist/server/config/defaults/webpack.config.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't add the default configurations here, you should be able resolve aliases without default storybook config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I just discovered that the errors I was getting earlier disappear if I return the config without creating a const newConfig
. I'll prepare a new commit
storybook/webpack.config.js
Outdated
// this is used by the custom `rr.js` module | ||
newConfig.resolve.alias['react-router-original'] = require.resolve('react-router') | ||
// this `rr.js` will replace the Link with a our own mock component | ||
newConfig.resolve.alias['react-router'] = require.resolve('./rr.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we rename rr.js
file to something maybe react-router.js
?
A fix proposition for Link component story, as well as other links in the Storybook - if we don't want them to throw an error after clicking.
Based on: storybookjs/storybook#485 (comment)
Right now I don't think we can use it like react-router's Link and avoid the need of specifying labels in the "label" parameter, though.