目錄
storybook實(shí)現(xiàn)antd部分引入組件樣式
開發(fā)時(shí)如果使用antd不可避免會(huì)遇到部分引入其樣式問(wèn)題堂湖,需要如下變動(dòng):
Using Storybook 4, you can create a webpack.config.js file in the .storybook directory with the following configuration:
const path = require("path");
module.exports = {
module: {
rules: [
{
test: /\.(js|mjs|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
options: {
presets: ["@babel/react"],
plugins: [
['import', {libraryName: "antd", style: true}]
]
},
},
{
test: /\.less$/,
loaders: [
"style-loader",
"css-loader",
{
loader: "less-loader",
options: {
modifyVars: {"@primary-color": "#d8df19"},
javascriptEnabled: true
}
}
],
include: path.resolve(__dirname, "../")
}
]
}
};
image.png