-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
74 lines (62 loc) · 1.76 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
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var Clean = require('clean-webpack-plugin');
var definePlugin = new webpack.DefinePlugin({
__DEVELOPMENT__: JSON.stringify(JSON.parse(process.env.WEBPACK_ENV === 'development')),
__DEBUG__: JSON.stringify(JSON.parse(process.env.WEBPACK_ENV === 'debug')),
__BUILD__: JSON.stringify(JSON.parse(process.env.WEBPACK_ENV === 'build')),
__VERSION__: (new Date().getTime().toString())
});
module.exports = {
entry: {
index: [
__dirname + '/source/assets/stylesheets/index.scss',
__dirname + '/source/assets/javascripts/index.js'
]
},
resolve: {
root: __dirname + '/source/assets/javascripts',
},
output: {
// publicPath: '/',
path: __dirname + '/.tmp/dist',
filename: 'assets/javascripts/[name].bundle.js'
},
module: {
loaders: [
{
test: /source\/assets\/javascripts\/*\.js$/,
exclude: /node_modules|\.tmp|vendor/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-0']
}
},
{
test: /.*\.scss$/,
loader: ExtractTextPlugin.extract(
"style",
"css!sass?sourceMap&includePaths[]=" + __dirname + "/node_modules"
)
},
{ test: /\.css$/, loader: "style!css" },
{
test: /.*\.(gif|png|jpe?g|jpg|svg|pdf)$/i,
loader: "file?hash=sha512&digest=hex&name=assets/images/[name].[ext]"
}
]
},
node: {
console: true
},
// watch: true,
plugins: [
definePlugin,
new Clean(['.tmp']),
new ExtractTextPlugin("assets/stylesheets/index.bundle.css")
],
resolve: {
moduleDirectories: ['node_modules'],
extensions: ['', '.js', '.scss']
}
};