Repository navigation
Expand file tree
/
Copy pathrollup.config.js
More file actions
69 lines (66 loc) Β· 1.82 KB
/
Copy pathrollup.config.js
File metadata and controls
69 lines (66 loc) Β· 1.82 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
/**
* Rollup configuration for Svelte webview components
* Updated for Svelte 5 compatibility
*/
import svelte from 'rollup-plugin-svelte';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
const production = !process.env.ROLLUP_WATCH;
/**
* Create config for a webview component
*/
function createConfig(input, output) {
return {
input,
output: {
sourcemap: !production,
format: 'iife',
name: 'SvelteApp',
file: output,
},
plugins: [
svelte({
preprocess: sveltePreprocess({
sourceMap: !production,
typescript: {
tsconfigFile: './webview/tsconfig.json',
},
}),
compilerOptions: {
dev: !production,
// Svelte 5: Use compatibility mode (runes: false) for legacy syntax
runes: false,
},
emitCss: false, // Inline CSS instead of emitting separate files
}),
resolve({
browser: true,
dedupe: ['svelte'],
exportConditions: ['svelte', 'browser'],
}),
commonjs(),
typescript({
tsconfig: './webview/tsconfig.json',
sourceMap: !production,
inlineSources: !production,
}),
production &&
terser({
compress: {
drop_console: false, // Keep console.log statements for debugging
},
}),
],
watch: {
clearScreen: false,
},
};
}
export default [
createConfig('webview/sidebar-wrapper.js', 'dist/sidebar.js'),
createConfig('webview/workflow-runs-wrapper.js', 'dist/workflow-runs.js'),
createConfig('webview/log-viewer-wrapper.js', 'dist/log-viewer.js'),
];