-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
72 lines (71 loc) · 2.34 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
var path = require('path'),
fs = require('fs'),
webpack = require("webpack"),
libPath = path.join(__dirname, 'lib'),
wwwPath = path.join(__dirname, 'www'),
pkg = require('./package.json'),
HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
vendor: path.join(libPath, 'index.coffee'),
home: path.join(libPath, 'home', 'home.coffee'),
gettingStarted: path.join(libPath, 'gettingStarted', 'gettingStarted.coffee'),
},
output: {
path: wwwPath,
filename: '[name].bundle-[hash:6].js',
chunkFilename: "[id].bundle.js"
},
module: {
loaders: [{
test: /\.html$/,
loader: 'html'
}, {
test: /\.md$/,
loader: "html!markdown"
}, {
test: /\.json$/,
loader: "json"
}, {
test: /\.(png|jpg)$/,
loader: 'file?name=img/[name].[ext]' // inline base64 URLs for <=10kb images, direct URLs for the rest
}, {
test: /\.css$/,
loader: "style!css"
}, {
test: /\.coffee$/,
loader: "coffee"
}, {
test: /\.scss$/,
loader: "style!css!autoprefixer!sass"
}, {
test: [/fontawesome-webfont\.svg/, /fontawesome-webfont\.eot/, /fontawesome-webfont\.ttf/, /fontawesome-webfont\.woff/],
loader: 'file?name=fonts/[name].[ext]'
}]
},
resolve: {
extensions: ['', '.js', '.json', '.scss', '.coffee', '.html']
},
externals: {
"jquery": "jQuery"
},
plugins: [
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor-[hash:6].js"),
new webpack.optimize.CommonsChunkPlugin("home", "home-[hash:6].js"),
new webpack.optimize.CommonsChunkPlugin("gettingStarted", "gettingStarted-[hash:6].js"),
new HtmlWebpackPlugin({
filename: 'index.html',
pkg: pkg,
// chunks: ['home'],
// excludeChunks: ['gettingStarted'],
template: path.join(libPath, 'home.html')
}),
new HtmlWebpackPlugin({
filename: 'getting-started.html',
pkg: pkg,
// chunks: ['gettingStarted'],
// excludeChunks: ['home'],
template: path.join(libPath, 'gettingStarted.html')
})
]
};