Closed trumbitta closed 4 years ago
Hi there @trumbitta ! Thanks for filing an issue!
Please take a look at issue #3255 . I think that your issue might be related to that, and it will possibly be fixed after the Nx upgrade to Storybook 6, which is still in the works.
Please let me know if this helps, or if you need any further assistance at the moment!
Hi @trumbitta ! I believe your issue should be solved in the next release, fixed by PR #3611 .
If you take a look at the new webpack.config.js
template, we are adding svgr support out of the box now.
I will close this issue now, but let me know if your issue persists!
@mandarini oh nice! Thank you! These days I'm working on a different part of the monorepo, but I will update it shortly after the next release!
Hi @mandarini !
I'm updating my monorepo to Nx 10.3 and StoryBook to v6 and I found this config in the autogenerated webpack.config.js
:D
I'm reporting that in order to make it work with MDX, which I switched my stories to after writing this workaround, I had to modify this part:
issuer: {
test: /\.[jt]sx?$/,
},
to:
issuer: {
test: /\.[jtm][sd]x?$/,
},
Since the original workaround comes from the SVGR config for webpack that Nx used back when I submitted this issue, maybe ya'll want to check also that and see if you want to support MDX out of the box :)
I also had to add this rollup.config.js
to make my components lib build into a publishable library:
/* eslint-disable @typescript-eslint/no-var-requires */
module.exports = (config) => {
const svgr = require('@svgr/rollup').default;
const url = require('@rollup/plugin-url');
return {
...config,
plugins: [
...config.plugins,
url(),
svgr({
svgo: false,
ref: true,
titleProp: true,
}),
],
};
};
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Expected Behavior
Webpack conf generated by the Storybook schematics should have the same conf for SVGR the main webpack conf has.
Current Behavior
Nx-generated Storybook conf doesn't support SVGR out of the box.
Context
Please provide any relevant information about your setup:
Other
And this is how I managed to make it work: