Open salzpate opened 1 year ago
Hey @salzpate 👋
I'm sorry for the frustration but with the way this addon currently work, all of those packages are dependencies to make sure that webpack can be configured properly for the use cases it supports as well as the configuration scripts.
I'm actively working on v2 which changes the API to avoid this all together.
If you're interested i'd love your help in testing it out for your use case?
Ok, then it's understandable why you didn't take dev dependencies. Sure, just let me know and I'll test the new version.
@salzpate, Amazing! Thank you for your help!
Can you share the contents of your main.(ts|js)
with me so that I can provide next steps?
In the main.ts file are only some exports of some components of a component library
Sorry @salzpate, I mean your .storybook/main.ts
.storybook/main.ts:
`const path = require('path');
const babelConfig = require('../babel.config.js');
module.exports = { stories: ['../stories/*/.stories.tsx'], addons: [ '@storybook/addon-links', '@storybook/addon-styling', '@storybook/addon-essentials', ], features: { postcss: false, }, webpackFinal: async (config) => { config.resolve.extensions = ['.mjs', '.ts', '.tsx', '.js', '.json'];
config.module.rules.push({
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
...babelConfig,
},
},
],
});
config.module.rules.push({
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
});
config.module.rules.push({
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
});
return config;
}, typescript: { check: true }, framework: { name: '@storybook/react-webpack5', options: {} }, docs: { autodocs: true } }; `
Hey @salzpate So there's a couple of things we'll need to do.
@storybook/addon-styling
from main.ts
@storybook/addon-styling
from your dependencieswebpackFinal
in main.ts
npx storybook@latest add @storybook/addon-styling-webpack
This should add the new addon to your dependencies and your storybook config with the webpack rules that you need.
After the command:
npx storybook@latest add @storybook/addon-styling-webpack
the addon is installed and set in the main.js file but I get an error:
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
And tailwindcss styling is not loaded in storybook
Hey @salzpate thank you for getting back to me :)
I have a fix for the type error that i'm waiting to get patched back into the Storybook CLI for 7.4.1
In the mean time you can run npx @storybook/auto-config styling
to configure the addon for you :)
Describe the bug
Some DevDependencies are installed as dependencies. This can lead to conflicts if, for example, prettier 3.0.0 is used.
Steps to reproduce the behavior
Expected behavior
Add Dev Dependencies as devDependencies:
"devDependencies": { "@babel/template": "^7.20.7", "@babel/types": "^7.21.5",
"css-loader": "^6.7.3", "less-loader": "^11.1.0", "postcss-loader": "^7.2.4", "prettier": "^2.8.0", "resolve-url-loader": "^5.0.0", "sass-loader": "^13.2.2", "style-loader": "^3.3.2" }
Screenshots and/or logs
Found: prettier@2.8.8 npm ERR! node_modules/prettier npm ERR! dev prettier@"^2.8.8" from the root project npm ERR! prettier@"^2.8.0" from @storybook/addon-styling@1.3.5
Environment