-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
58 lines (55 loc) · 1.06 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
/**
* This file contains the webpack configuration.
*/
// Include dependencies
const path = require( 'path' );
const ExtractTextPlugin = require( 'extract-text-webpack-plugin' );
// Helper vars
const assets = path.resolve( __dirname, 'assets' );
// Export config.
module.exports = {
context: assets,
entry: {
blocks: [
'./js/src/blocks.js',
'./css/src/blocks.scss'
]
},
output: {
path: assets,
filename: 'js/dist/[name].bundle.js'
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: [/node_modules/]
},
{
test: /\.(jpe?g|gif|png|svg)$/,
use: 'file-loader?emitFile=false&name=[path][name].[ext]'
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract( {
fallback: 'style-loader',
use: [{
loader: 'css-loader',
options: {
minimize: true
}
}, 'postcss-loader', 'sass-loader'],
publicPath: '../../'
} )
}
]
},
plugins: [
new ExtractTextPlugin( {
filename: 'css/dist/[name].css',
allChunks: true
} )
]
};