-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.common.js
60 lines (58 loc) · 1.34 KB
/
webpack.common.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
// https://medium.com/webpack/predictable-long-term-caching-with-webpack-d3eee1d3fa31
'use strict'
/* global __dirname module require */
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
vendor: [
'raven-js',
'intl-messageformat'
],
engine: './src/engine.js',
main: './index.js'
},
output: {
path: path.resolve(__dirname, 'dist')
},
resolve: {
modules: ['node_modules', 'bower_components'],
descriptionFiles: ['package.json'],
alias: {
// fix for script tag import in app-localize-behavior.html
'../intl-messageformat/dist/intl-messageformat.min.js': 'intl-messageformat'
}
},
module: {
rules: [
{
test: /\.html$/,
use: [
{
loader: 'polymer-webpack-loader'
}
]
}
]
},
plugins: [
new webpack.NamedChunksPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'engine',
chunks: ['engine', 'main'],
minChunks: 2
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest'
}),
new HtmlWebpackPlugin({
inject: 'head',
template: 'index.ejs'
})
]
}