-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.config.js
94 lines (91 loc) · 3.04 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const path = require('path')
const OfflinePlugin = require('offline-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackShellPlugin = require('webpack-shell-plugin');
const offlinePluginOptions = {
appShell: '/',
autoUpdate: true,
caches:{
main: [
'index.js',
'index.html',
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular-animate.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.6/ngStorage.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.0.1/color-thief.min.js',
'https://fonts.googleapis.com/css?family=Montserrat:400,700',
'master-ball*.png',
'quick-ball*.png',
'dive-ball*.png',
'manifest.json'
],
additional: [
]
},
externals: [
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.7/angular-animate.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.6/ngStorage.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/color-thief/2.0.1/color-thief.min.js',
'https://fonts.googleapis.com/css?family=Montserrat:400,700',
'manifest.json'
],
ServiceWorker: {
events: true
},
version: '[hash]',
safeToUseOptionalCaches: true,
ServiceWorker: {
entry: './src/scripts/sw/swApiCalls.js'
}
}
module.exports = {
target: 'web',
devtool: 'sourcemap',
entry: {
'index': './src/scripts/index.js'
},
output: {
libraryTarget: 'umd',
path: 'dist/',
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style-loader!css-loader!autoprefixer-loader'
},
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loaders: ['ng-annotate', 'babel?presets[]=es2015']
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.html$/,
loader: "html-loader?interpolate=require"
},
{
test: /.*\.(gif|png|jpe?g|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[name][hash].[ext]&esModule=false',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "65-90", speed: 4}}'
],
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: 'src/include/index.html',
inject: 'head',
hash: true,
cache: false
}),
new OfflinePlugin(offlinePluginOptions),
new WebpackShellPlugin({onBuildStart:[], onBuildEnd:['npm run copyManifest'], dev: 0})
]
};