所遇bug

一、用create-react-app搭建的项目,运行npm run eject释放配置之后,引入storybook,遇到如图

所遇bug

 sass引入解析错误
解决方法 .storybook文件夹下sass如下配置

main.js
const path = require('path'); const resolve = (pathName) => path.resolve(__dirname, pathName); module.exports = { "stories": [ "../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)" ], "addons": [ "@storybook/addon-links", "@storybook/addon-essentials" ], webpackFinal: async (config) => { config.resolve.alias['@'] = resolve('../src'); config.module.rules.push({ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] //使用这种方式引入 }); return config; } }

 

上一篇:Error:Node Sass version 6.0.0 is incompatible with ^4.0.0


下一篇:vue ckeditor5 富文本使用及自定义阿里上传