-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.config.single-page.js
More file actions
53 lines (49 loc) · 1.32 KB
/
webpack.config.single-page.js
File metadata and controls
53 lines (49 loc) · 1.32 KB
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
var webpack = require('webpack');
var path = require('path');
var rimraf = require('rimraf');
var buildOutputPath = path.join(__dirname, 'build/single-page/static');
rimraf.sync(buildOutputPath);
module.exports = {
context: __dirname + "/src",
entry: {
'vendor': ['jquery', 'underscore', 'backbone'],
'page-clicks': ['Page/clicks.js']
},
resolve: {
modulesDirectories: ['vendor', 'src/js', 'src/styles', 'src/img', 'node_modules']
},
plugins: [
new webpack.ProvidePlugin({
'$': 'jquery',
'_': 'underscore',
'Backbone': 'backbone'
})
, new webpack.optimize.CommonsChunkPlugin({
name: 'page-b',
chunks: ['Page/B-A', 'Page/B-B']
})
, new webpack.optimize.CommonsChunkPlugin({
name: 'page-module',
chunks: ['page-b', 'Page/A']
})
, new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: ['page-clicks', 'page-module']
})
],
module: {
loaders: [
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader"
},
//3064 is set to show you how an image can be inlined into output entry. See BB.jpg.
{test: /\.(png|jpg)$/, loader: 'url-loader?limit=3064'}
]
},
output: {
path: buildOutputPath,
filename: '[name].js',
publicPath: path.join(buildOutputPath, '/')
}
};