Skip to content
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

fix: update config to handle stories.tsx #139

Merged
merged 1 commit into from
Dec 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ module.exports = ({ config }) => {
config.resolve.extensions.push('.ts', '.tsx');

config.module.rules.push({
test: /stories.js$/u,
loaders: [require.resolve('@storybook/addon-storysource/loader')],
test: /stories.tsx$/u,
loader: require.resolve('@storybook/source-loader'),
Copy link
Contributor Author

@hzhu hzhu Dec 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@storybook/addon-storysource/loader is deprecated and the project needs to specify @storybook/source-loader instead.

DeprecationWarning: @storybook/addon-storysource/loader is deprecated, please use @storybook/source-loader instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed from package.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does not have to be removed from the package.json because storysource is still used, but the loader is now located in a different place (at @storybook/source-loader).

enforce: 'pre'
});

Expand All @@ -39,6 +39,10 @@ module.exports = ({ config }) => {
{
loader: 'ts-loader',
options: {
// Temporarily ignore implicit any warnings caused by source-loader.
// Ignoring 7005 can be removed when the GitHub issue is resolved.
// See: https://github.com/storybookjs/storybook/issues/7829
ignoreDiagnostics: [7005],
Copy link
Contributor Author

@hzhu hzhu Dec 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a result of having to parse TypeScript, source-loader is causing implicit any warnings on Storybook examples. This line can be removed once this GitHub issue is resolved.

configFile: path.resolve(__dirname, 'tsconfig.storybook.json')
}
}
Expand Down