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

Add ts and tsx extensions or allow to extend webpack extensions field. #661

Closed
niba opened this issue Jan 5, 2017 · 4 comments
Closed

Comments

@niba
Copy link

niba commented Jan 5, 2017

Hello,
I have the same issue like #562 but with .tsx extension. I can't extend extensions field in my custom webpack config and I need that to make it work with my typescript project.

@sir-marc
Copy link

the referenced issue is fixed?
could you describe your problem with more details? And maybe a way to reproduce.

@niba
Copy link
Author

niba commented Jan 10, 2017

The referenced issue is about JSX extension. I have problem with TSX and TS extensions. My project is written in Typescript and all my files are ts or tsx. I use ts-loader loader to produce valid webpack bundle. Storybooks gives my an option to add my custom loader but it doesn't allow to extend extension field and without that I can't tell webpack to take ts and tsx files which are required by ts-loader to produce valid component bundle.
Because of that I can't test my components written in Typescript.
There are two ways how to solve it.

  1. Add ts and tsx extension to your base webpack config.
  2. Allow users to override extension field. (https://github.com/storybooks/react-storybook/blob/master/src/server/config/webpack.config.js#L55)

@sir-marc
Copy link

Oh sorry, I missed that.
I'm also working with typescript in two projects and both work well with storybook.
My setup:
right next to the config.js file, I have a webpack.config.js file which is basically nothing more than an import export.

const webpackConfig = require('./../../webpack.config.js');
module.exports = webpackConfig;

in my default webpack.config.js file, i added the extension '.tsx'.
This works just fine for me.

@niba
Copy link
Author

niba commented Jan 12, 2017

Yeah, you are right. Totally forgot that you can override entire webpack configuration. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants