-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
71 lines (64 loc) · 1.79 KB
/
webpack.config.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// https://github.com/storybooks/storybook/issues/270#issuecomment-318101549
// this config augments the storybook one with support for css modules
// storybook does not have support for css modules out of the box
// if CRA were to be present, storybook webpack augment those configs
// module.exports = {
// module: {
// rules: [
// {
// test: /\.module.css$/,
// use: [
// {
// loader: "style-loader"
// },
// {
// loader: "css-loader",
// options: {
// modules: true
// }
// }
// ]
// },
// {
// test: /\.scss$/,
// use: [
// {
// loader: "style-loader"
// },
// {
// loader: "css-loader",
// options: {
// sourceMap: true
// }
// },
// {
// loader: "sass-loader",
// options: {
// sourcemap: true
// }
// }
// ]
// }
// ]
// }
// };
const path = require('path');
// Export a function. Accept the base config as the only param.
module.exports = async ({ config, mode }) => {
// `mode` 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, '../'),
});
config.module.rules.push({
test: /\.module.css$/,
use: ['style-loader', 'css-loader'],
include: path.resolve(__dirname, '../'),
});
// Return the altered config
return config;
};