-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
120 lines (104 loc) · 3.47 KB
/
vue.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
process.env.VUE_APP_VERSION = require('./package.json').version
const path = require('path')
const SentryWebpackPlugin = require('@sentry/webpack-plugin')
const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
pwa: {
name: process.env.VUE_APP_TITLE,
manifestPath: 'site.webmanifest',
themeColor: '#007300',
msTileColor: '#007300',
workboxOptions: {
navigateFallback: '/index.html',
navigateFallbackDenylist: [/\./, /\/api(?:[/?].*)?$/]
},
manifestOptions: {
name: process.env.VUE_APP_TITLE,
short_name: process.env.VUE_APP_SHORT,
description: process.env.VUE_APP_DESCRIPTION,
categories: process.env.VUE_APP_CATEGORIES.split(','),
keywords: process.env.VUE_APP_KEYWORDS.split(','),
theme_color: '#007300',
background_color: '#ffffff',
scope: '/',
start_url: '/',
shortcuts: [
{
name: 'Urnik',
url: '/timetable',
icons: [{
src: '/img/shortcuts/timetable.png',
type: 'image/png',
sizes: '192x192'
}]
},
{
name: 'Jedilnik',
url: '/menus',
icons: [{
src: '/img/shortcuts/menus.png',
type: 'image/png',
sizes: '192x192'
}]
},
{
name: 'Okrožnice',
url: '/documents',
icons: [{
src: '/img/shortcuts/documents.png',
type: 'image/png',
sizes: '192x192'
}]
}
]
}
},
chainWebpack: config => {
config.plugin('preload').use(PreloadWebpackPlugin, [{
rel: 'preload',
include: {
type: 'allChunks',
chunks: ['app', 'chunk-vendors', 'home', 'timetable']
},
as (entry) {
if (/\.css$/.test(entry)) return 'style'
if (/\.woff$/.test(entry)) return 'font'
if (/\.woff2$/.test(entry)) return 'font'
if (/\.png$/.test(entry)) return 'image'
if (/\.svg$/.test(entry)) return 'image'
return 'script'
}
}])
},
configureWebpack: (config) => {
config.output.devtoolFallbackModuleFilenameTemplate = 'webpack:///[resource-path]?[hash]'
config.output.devtoolModuleFilenameTemplate = info => {
const isVue = info.resourcePath.match(/\.vue$/)
const isScript = info.query.match(/type=script/)
const hasModuleId = info.moduleId !== ''
const resourcePath = path.normalize(info.resourcePath).replaceAll('\\', '/')
if (isVue && (!isScript || hasModuleId)) {
// Detect generated files, filter as webpack-generated
return `webpack-generated:///${resourcePath}?${info.hash}`
} else {
// If not generated, filter as webpack
return `webpack:///${resourcePath}`
}
}
// Upload sourcemaps to Sentry if enabled
if (process.env.SENTRY_UPLOAD_SOURCEMAPS === 'true') {
const releasePrefix = process.env.VUE_APP_SENTRY_RELEASE_PREFIX || ''
const releaseSuffix = process.env.VUE_APP_SENTRY_RELEASE_SUFFIX || ''
const releaseVersion = releasePrefix + process.env.VUE_APP_VERSION + releaseSuffix
config.plugins.push(new SentryWebpackPlugin({
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
release: releaseVersion,
include: './dist',
finalize: false
}))
}
}
})