-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
95 lines (80 loc) · 2.54 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
95
var path = require('path');
var Encore = require('@symfony/webpack-encore');
var OfflinePlugin = require('offline-plugin');
var ManifestPlugin = require('manifest-webpack-plugin');
var commonChunk = require("webpack/lib/optimize/CommonsChunkPlugin");
var VueLoaderPlugin = require('vue-loader/lib/plugin')
//var jwtDecode = require('jwt-decode');
Encore
.setOutputPath('public/build/')
.cleanupOutputBeforeBuild()
.setPublicPath('/build')
.enableSassLoader()
.enableSourceMaps(!Encore.isProduction())
.addEntry('js/vendor', './assets/js/vendor.js')
.addEntry('js/vue', './assets/js/vue.js')
.addEntry('js/sw', './assets/js/sw.js')
.addStyleEntry('css/app', './assets/scss/app.scss')
.addPlugin(new VueLoaderPlugin())
// show OS notifications when builds finish/fail
.enableBuildNotifications()
.enableVueLoader()
// create hashed filenames (e.g. app.abc123.css)
// .enableVersioning()
;
module.exports = Encore.getWebpackConfig();
var config = Encore.getWebpackConfig();
config.plugins.push(new commonChunk({
name: 'commonChunk',
async: true
}));
config.plugins.push(new ManifestPlugin({
fileName: 'manifest.json',
basePath: '/public/build/',
seed: {
"short_name": "QuoteDB",
"name": "SymfonyVue",
"start_url": "/",
"icons": [{
"src": "/build/images/256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "/build/images/512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"background_color": "#FAFAFA",
"theme_color": "#e10b0b",
"display": "standalone",
"orientation": "portrait",
"gcm_sender_id": "314804067424"
}
}));
config.plugins.push(new OfflinePlugin({
"strategy": "changed",
"responseStrategy": "cache-first",
"publicPath": "/build/",
"caches": {
// offline plugin doesn't know about build folder
// if I added build in it , it will show something like : OfflinePlugin: Cache pattern [build/images/*] did not match any assets
"main": [
'*.json',
'css/*.css',
'js/*.js',
'img/*'
]
},
"ServiceWorker": {
"events": !Encore.isProduction(),
"entry": "./assets/js/sw.js",
"cacheName": "QuoteDB",
"navigateFallbackURL": '/',
"minify": !Encore.isProduction(),
"output": "./../js/sw.js",
"scope": "/"
},
"AppCache": null
}));