其他分享
首页 > 其他分享> > 所遇bug

所遇bug

作者:互联网

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

 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; } }

 

标签:resolve,所遇,..,loader,storybook,path,config,bug
来源: https://www.cnblogs.com/zhihou/p/15476250.html