SassError与scss和故事书

时间:2020-08-26 15:39:23

标签: reactjs sass storybook

我试图将@coreui包中的样式添加到我的组件库中。但是,在运行纱线故事书时出现错误。

我的.storybook / main.js

const path = require("path");

module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/preset-create-react-app",
  ],
  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: /\.scss$/,
      use: ["style-loader", "css-loader", "sass-loader"],
      include: path.resolve(__dirname, "../"),
    });

    // Return the altered config
    return config;
  },
};

错误 enter image description here

styles.scss:

// Import CoreUI styles
@import "~@coreui/coreui/scss/coreui.scss";

0 个答案:

没有答案