-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
68 lines (68 loc) · 1.61 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
/* eslint-env node */
var dependencies = require('./package.json').dependencies
var HtmlWebpackPlugin = require('html-webpack-plugin')
var path = require('path')
var webpack = require('webpack')
var isVendor = function(module){
return (module.resource && module.resource.includes('node_modules'))
}
//These files don't like being webpacked. So we'll skip them.
module.exports = {
entry: {
'app': ['babel-polyfill', './src/index.js'],
'vendor': Object.keys(dependencies)
},
output: {
path: path.join(__dirname, 'docs'),
filename: '[name].bundle.[chunkhash:8].js'
},
module: {
rules: [
{
test: /\.js?$/,
use: [
'babel-loader'
],
exclude: /(node_modules)/
},{
test: /\.less$/,
use: [
'style-loader',
{loader: 'css-loader', options: { url: false }},
'less-loader'
],
exclude: /(node_modules)/
},{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},{
test: /\.(png|jpg|gif)$/,
use: ['url-loader']
},{
test: /\.svg$/,
use: ['raw-loader']
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor'],
minChunks: isVendor
}),
new HtmlWebpackPlugin({
title: 'Mully',
template: 'src/index.ejs',
filename: 'index.html',
chunks: ['app', 'vendor']
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
]
};