-
Notifications
You must be signed in to change notification settings - Fork 266
/
main.js
38 lines (33 loc) 路 1.2 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
stories: ["../**/src/**/*.stories.tsx"],
addons: ["@storybook/addon-controls"],
core: {
builder: "webpack5",
},
typescript: {
reactDocgen: false,
},
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.
// Check docs here: https://storybook.js.org/docs/react/configure/webpack#extending-storybooks-webpack-config
config.plugins.push(new MiniCssExtractPlugin({ filename: "[name].css" }));
// Add Linaria loader after babel-loader
config.module.rules.splice(1, 0, {
test: /\.tsx?$/,
exclude: /node_modules/,
use: [
{
loader: require.resolve("@linaria/webpack-loader"),
options: {
sourceMap: true,
},
},
],
});
config.optimization.minimize = false;
return config;
},
};