-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
66 lines (63 loc) · 2.3 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
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = function () {
var distPathSave = path.resolve('./dist/');
var distPathLoad = 'dist/';
console.log('Running with NODE_ENV: ' + process.env.NODE_ENV);
return {
cache: false,
devtool: 'source-map',
module: {
loaders: [
{
test: /\.(gif|png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
},
{
test: /\.pcss$/,
loader: (process.env.NODE_ENV == 'test' ?
['style-loader', 'css-loader', 'postcss-loader?config=./']
: ExtractTextPlugin.extract({
loader: ['css-loader?sourceMap', 'postcss-loader?sourceMap&config=./']
}))
},
{
test: /\.css$/,
loader: ['style-loader', 'css-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: [require('babel-preset-es2015')],
plugins: (process.env.NODE_ENV == 'test' ? ['istanbul'] : [])
}
}
]
},
resolve: {
modules: [
path.resolve('./node_modules/')
]
},
entry: {
'sorti-boxes': [
'./source/js/sorti-boxes.js'
]
},
plugins: (process.env.NODE_ENV == 'test' ?
[] :
[new ExtractTextPlugin({
filename: 'themes/default.css', // css are saved in: [path + plugins.ExtractTextPlugin.filename]
allChunks: false
}),
]),
output: {
path: distPathSave, // JS/chunk is saved in: [path + filename/chunkFilename]
publicPath: distPathLoad, // chunk is loaded from: [publicPath + chunkFilename]
filename: 'js/[name].js',
chunkFilename: 'js/[name].[chunkhash].js' // System.import doesn't support named chunks
}
}
};