-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
65 lines (64 loc) · 1.69 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
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
module.exports = {
entry: {
app: './src/js/index.js',
vendor: './src/js/vendor.js'
},
output: {
filename: 'dist/js/[name].js',
publicPath: '../../'
},
module: {
rules: [
{ // STYE LOADERS
test: /\.(css|sass|scss)$/,
use: ExtractTextPlugin.extract({
use: ['css-loader', 'postcss-loader', 'sass-loader'],
})
},
{ // JS LOADERS
loader: 'babel-loader',
query: {
presets: ['es2015']
},
test: /\.js$/,
exclude: /node_modules/
},
{ // URL LOADER, IMAGE FILES
test: /\.(jpe?g|png|svg)/,
loader: 'url-loader?limit=10000&name=dist/img/[name].[ext]', //if < 10 kb, base64 encode img to css
},
{ // URL LOADER, FONTS
test: /\.(woff|woff2|eot|ttf)/,
loader: 'url-loader?limit=10000&name=dist/fonts/[name].[ext]', //font files to './dist/fonts/**.'
},
/*{ // FILE-LOADER
test: /\.woff|woff2|eot|ttf|svg|jpe?g|png/,
loader: 'file-loader',
options: {
name: 'dist/img/[name].[ext]',
publicPath: function(url) {
return url.replace(/dist/, '..')
},
},
},*/
]
},
plugins: [
new ExtractTextPlugin({
filename: 'dist/css/style.css',
allChunks: true,
}),
new BrowserSyncPlugin({
notify: false, // hide the notification
host: 'localhost',
port: 3000,
proxy: 'http://localhost/bem-webpack-boiler',
files: [
'**/*.html'
]
})
],
};