Skip to content

Commit 3ed6373

Browse files
committed
TO REMOVE
Once nextcloud-libraries/nextcloud-vite-config#630 is in Signed-off-by: Louis Chemineau <[email protected]>
1 parent 4ccae82 commit 3ed6373

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

vite.config.ts

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { UserConfig } from 'vitest/node'
2+
23
import { createAppConfig } from '@nextcloud/vite-config'
3-
import { join } from 'path'
4+
import { join, relative } from 'path'
45

56
// replaced by vite
67
declare const __dirname: string
@@ -17,6 +18,31 @@ export default createAppConfig({
1718
// for REUSE we should enable:
1819
// extractLicenseInformation: true,
1920
config: {
21+
experimental: {
22+
renderBuiltUrl(filename, { hostType }) {
23+
if (hostType === 'css') {
24+
// CSS `url()` does not support any dynamic path, so we use relative path to the css files
25+
return relative('../css', `../${filename}`)
26+
}
27+
return {
28+
runtime: `window.OC.filePath('activity', 'js', '${filename}')`,
29+
}
30+
},
31+
},
32+
build: {
33+
outDir: 'js',
34+
assetsDir: '../',
35+
rollupOptions: {
36+
output: {
37+
entryFileNames: () => {
38+
return 'activity-[name].mjs'
39+
},
40+
chunkFileNames: () => {
41+
return '[name]-[hash].chunk.mjs'
42+
},
43+
},
44+
},
45+
},
2046
// Setup for vitest unit tests
2147
test: {
2248
environment: 'happy-dom',

0 commit comments

Comments
 (0)