-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
110 lines (82 loc) · 2 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
'use strict';
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var config = require('./_config'); //paths config..
module.exports = {
entry: [
config.build('js', 'src'), //JavaScript entry point
config.build('css', 'src') //CSS entry point
],
output: {
path: config.js.dest.path,
filename: config.js.dest.file //JavaScript end point
},
//quickest, webpack -d -p for production
devtool: 'eval',
module: {
//test: which filetype?,
//exclude: which folders to exclude
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
babelrc: path.join(__dirname, '.babelrc')
}
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint'
},
{
test: /\.(hbs|handlebars)$/,
exclude: /node_modules/,
loader: 'handlebars',
query: {
helperDirs: [
`${__dirname}/_helpers`
]
}
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!postcss!sass?outputStyle=expanded')
}
]
},
postcss: function(){
return [
require('postcss-will-change'),
require('postcss-cssnext')({
browsers: ['IE >= 10', 'last 2 version'],
features: {
autoprefixer: {
cascase: false
}
}
})
];
},
//webpack plugins
plugins: [
new webpack.optimize.DedupePlugin(),
//extract CSS into seperate file
new ExtractTextPlugin(
config.build('css', 'dest')
)
],
eslint: {
configFile: path.join(__dirname, '.eslintrc'),
ignorePath: path.join(__dirname, '.eslintignore')
},
resolve: {
extensions: ['', '.json', '.js', '.css', '.hbs', '.handlebars'],
fallback: path.join(__dirname, 'node_modules')
},
resolveLoader: {
fallback: path.join(__dirname, 'node_modules')
}
};