-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.shared.js
57 lines (53 loc) · 1.32 KB
/
webpack.config.shared.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
import webpack from 'webpack';
import path from 'path';
export const isResMatch = (res, match) => res.indexOf(match) !== -1;
export default {
entry: [
path.join(__dirname, `src`, `index`),
],
output: {
path: path.join(__dirname, `build`),
},
module: {
noParse: [`node_modules/react`],
loaders: [
{ test: /(.js|.jsx)/, exclude: /node_modules/, loaders: [`babel?cacheDirectory=true`] },
{ test: /src\/assets\/icons\/[^\.]+\.svg/, loader: `svg-sprite!svgo?useConfig=svgoIcons` },
],
},
stats: {
colors: true,
},
resolve: {
root: path.join(__dirname, `src`),
extensions: [``, `.js`, `.json`, `.jsx`, `.css`, `.scss`, `.svg`],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.DedupePlugin(),
],
postcss: (wbpck) => ([
require(`postcss-import`)({
addDependencyTo: wbpck,
}),
require(`postcss-sassy-mixins`),
require(`postcss-for`),
require(`postcss-conditionals`),
require(`postcss-simple-vars`),
require(`postcss-color-function`),
require(`postcss-mathjs`),
require(`postcss-nested`),
require(`autoprefixer`)({
browsers: [`last 2 versions`],
}),
]),
svgoIcons: {
plugins: [
{
removeAttrs: {
attrs: [`fill`, `fill-rule`],
},
},
],
},
};