-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathvite.config.js
More file actions
73 lines (71 loc) · 1.92 KB
/
vite.config.js
File metadata and controls
73 lines (71 loc) · 1.92 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { createAppConfig } from '@nextcloud/vite-config'
import { join, resolve } from 'path'
import { VitePWA } from 'vite-plugin-pwa'
export default createAppConfig(
{
icons: resolve(join('src', 'icons.css')),
init: resolve(join('src', 'init.js')),
main: resolve(join('src', 'main.js')),
reference: resolve(join('src', 'reference.js')),
'settings-admin': resolve(join('src', 'settings-admin.ts')),
},
{
config: {
build: {
rollupOptions: {
// Needed for Nextcloud >= 32. In 33 it got fixed
// with https://github.com/nextcloud/server/pull/56941
preserveEntrySignatures: 'strict',
},
},
css: {
modules: {
localsConvention: 'camelCase',
},
},
plugins: [
VitePWA({
// Don't generate a manifest file. It's provided by the theming app already
manifest: false,
// Don't try to inject service worker registration. We do it manually at Collectives.vue
injectRegister: false,
outDir: 'js',
// Enable service worker in development build
devOptions: { enabled: true },
strategies: 'injectManifest',
srcDir: 'src',
filename: 'service-worker.js',
injectManifest: {
// Adjust paths in precaching manifest URLs
manifestTransforms: [
async (manifest) => {
manifest.map((entry) => {
if (entry.url.startsWith('../css/')) {
entry.url = entry.url.replace('../css/', 'css/')
} else {
entry.url = 'js/' + entry.url
}
return entry
})
return { manifest, warnings: [] }
},
],
globPatterns: [
'../css/*.css',
'*.mjs',
],
maximumFileSizeToCacheInBytes: 5242880,
},
}),
],
},
createEmptyCSSEntryPoints: true,
emptyOutputDirectory: {
additionalDirectories: ['css'],
},
},
)