我正在尝试在故事书中加载自定义全局样式文件 theme-default.scss 。虽然我的组件正在故事书中加载,但没有应用样式。我遵循了自定义 webpack 配置的本教程故事书官方文档。(虽然我对 webpack 不是很熟悉)
这是我的 .storybook/main.js 文件
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
//import '!style-loader!css-loader!../src/stories/stories.scss'; // for scss
module.exports = {
stories: ['../src/**/*.stories.ts'],
addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-notes'],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.
// Make whatever fine-grained changes you need
config.module.rules.push({
test: …Run Code Online (Sandbox Code Playgroud)