-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
67 lines (64 loc) · 1.86 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
// you can use this file to add your custom webpack plugins, loaders and anything you like.
// This is just the basic way to add additional webpack configurations.
// For more information refer the docs: https://storybook.js.org/configurations/custom-webpack-config
// IMPORTANT
// When you add this file, we won't add the default configurations which is similar
// to "React Create App". This only has babel loader to load JavaScript.
const autoprefixer = require('autoprefixer');
const paths = require('./../config/paths');
module.exports = {
plugins: [
// your custom plugins
],
module: {
rules: [
{
exclude: [
/\.html$/,
/\.ejs$/,
/\.(js|jsx)$/,
/\.css$/,
/\.json$/,
new RegExp(`${paths.appSrc}.+\\.svg`),
],
loader: require.resolve('file-loader'),
},
{
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
],
},
{
test: new RegExp(`${paths.appSrc}.+\\.svg`),
use: [
require.resolve('react-svg-loader'),
],
},
],
},
};