Repository navigation
|
Looks like https://github.com/webpack/css-loader was archived a couple of months back. It looks like Do we know if there are any plans to remove css-loader as a direct dependency given that knowledge? Mostly asking because some of the css-loader modules have dependencies with CVEs associated with them now and the modules are using older versions of those dependencies that will probably not be patched. So we started migrating over to native webpack per the migration guide but we still get css-loader through builder-webpack5. |
Replies: 1 comment 4 replies
|
As far as I can see, nothing is tracked yet. It's used in Your options today:
// .storybook/main.ts
import type { StorybookConfig } from '@storybook/react-webpack5'
const usesCssLoader = (rule: any) =>
Array.isArray(rule?.use) &&
rule.use.some((u: any) => String(typeof u === 'string' ? u : u?.loader).includes('css-loader'))
const config: StorybookConfig = {
// ...
webpackFinal: async (config) => {
config.module ??= {}
config.module.rules = (config.module.rules ?? []).filter((r) => !usesCssLoader(r))
config.module.parser = { ...config.module.parser, 'css/auto': { exportType: 'style', namedExports: false } }
config.module.generator = { ...config.module.generator, 'css/auto': { exportsConvention: 'as-is' } }
config.experiments = { ...config.experiments, css: true }
return config
},
}
export default config
If you want this fixed upstream, a feature request pointing at that TODO is the way to go. The change is small: when native CSS is available, emit |
Makes sense. Silencing the warning for a
devDependencywhile keeping it on your radar seems like a reasonable approach for now.I had a look around, and I couldn't find an existing issue or PR tracking this on the Storybook side. Meanwhile,
@storybook/builder-webpack5@11.0.0-alpha.4still depends oncss-loader.It might be worth opening a feature request referencing the existing TODO in
base-webpack.config.ts. That would give you something concrete to reference in your exclusion list and give the team a place to discuss whether removing the dependency makes sense.If this helped resolve your question, feel free to mark it as the answer. It'll make it easier for others running into the sam…