forked from shanewilson/react-webpack-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
60 lines (55 loc) · 1.67 KB
/
webpack.base.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
'use strict';
var webpack = require('webpack');
var postcssTools = require('webpack-postcss-tools');
var varMap = postcssTools.makeVarMap('src/css/styles.css');
module.exports = {
target: 'web',
entry: './src/entry.jsx',
output: {
path: './dist/js',
pathInfo: true,
publicPath: '/js/',
filename: 'main.js',
css: 'style.css'
},
module: {
preLoaders: [
{test: /\.jsx?$/, loader: 'eslint-loader', exclude: /node_modules/}
],
loaders: [
{test: /\.png$/, loader: 'url?mimetype=image/png'},
{test: /\.gif$/, loader: 'url?mimetype=image/gif'},
{test: /\.jpe?g$/, loader: 'url?mimetype=image/jpeg'},
{test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&minetype=application/font-woff'},
{test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file'}
],
noParse: /\.min\.js/
},
postcss: [
// Plugins seem to be first in last out
// https://github.com/postcss/postcss#plugins
postcssTools.prependTildesToImports,
// Fallbacks
require('autoprefixer-core')({browsers: ['last 2 version']}),
// Future CSS Syntax
require('postcss-custom-properties')({variables: varMap.vars}),
require('postcss-custom-media')({extensions: varMap.media}),
require('postcss-custom-selectors')({extensions: varMap.selector}),
require('postcss-media-minmax')(),
require('postcss-color-function')()
//require('postcss-bem-linter')({
// namespace: 'ns'
//})
],
resolve: {
extentions: ['js', 'jsx', 'css']
}
,
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
]
};