-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
New custom webpack customization hook doesn't act the same as old version #9396
Comments
Experienced a similar issue...when looking at what Storybook logs upon startup, it seems like the |
@liorgreenb please change the |
I'm experiencing this issue with both |
I just managed to get it working, here's my config: webpackFinal: config => {
// Remove SB's `/\.css$/,` rule as we replace it with our own that works on
// CSS files with the `.module.css` extension for enabling CSS Modules.
config.module.rules = config.module.rules.filter(f => f.test.toString() !== '/\\.css$/');
config.module.rules.push({
test: FILENAME_REGEX,
sideEffects: true,
include: path.resolve(__dirname, paths.root),
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
localsConvention: 'camelCase',
modules: { localIdentName: LocalIndentName.DEV },
},
},
'postcss-loader',
],
});
return config;
},
Another issue I'm now facing (on |
@ndelangen |
Does not work for me with // main.js
module.exports = {
stories: ['../**/*.stories.ts'],
addons: [
'@storybook/addon-actions',
'@storybook/addon-links',
'@storybook/addon-notes',
'@storybook/addon-knobs',
'@storybook/addon-options'
],
webpackFinal: async (config, { configType }) => {
config.module.rules.unshift({
test: /\.scss$/,
loaders: ['raw-loader', 'sass-loader']
});
return config;
}
}; notice the ➜ yarn storybook
yarn run v1.21.1
$ start-storybook -p 6006
info @storybook/angular v5.3.9
info
info => Loading presets
info => Loading presets
info => Loading custom manager config.
info => Loading config/preview file in "./.storybook".
info => Adding stories defined in ".storybook/main.js".
info => Found custom tsconfig.json
info => Using default Webpack setup.
info => Using angular project 'sideproject-client' for configuring Storybook.
info => Loading angular-cli config.
info => Get angular-cli webpack config.
Starting type checking service...
Using 1 worker with 2048MB memory limit |
I'd be happy to take a look @nexxado. It'd be really helpful if you could provide a reproduction repo for me to checkout 🙇 |
Can't seem to replicate it in a new repo. |
Having issues with @svgr/webpack here too. Anyone get it working? |
Got it working with
The issue is that there is already an existing rule for svg, which is using file-loader. So, removing "svg" from that rule test, then adding a separate svg rule using |
I get an error |
Having a similar issue as B3Kay - worked until I upgraded from 6.2.x to 6.3.x - in my case failing on rule.test.test
|
Problem was that the rule was not there anymore, so I needed to account for that case.
|
Describe the bug
I tried to migrate my storybook to work with the new
main.js
configuration, part of it was moving thewebpack.config.js
be thewebpack
property in themain.js
file.Overall, i tried to change the configuration with
.svg
files, which storybook usesfile-loader
and I want to use@svgr/webpack
orsvg-inline-loader
.Previously, i changed the loader rule as mentioned here:
#6188 (comment)
Using the 'webpack' function in main js:
The inputed config i got did NOT have the file loader module rule (seems to be added after customization), so it didn't work.
Using the old separate
webpack.config.js
:Seems to receive the full storybook webpack config, to it did work.
To Reproduce
Try to change the configuration for
svg
files usingNow importing a
.svg
file should be imported as a react component (or a string if usingsvg-inline-loader
instead of usingfile-loader
and reciving a url.Expected behavior
I expected to receive the final storybook webpack configuration to allow full modification, making the
svg
loader changeable.System:
The text was updated successfully, but these errors were encountered: