2020-11-11 00:00:54 +01:00
|
|
|
import svelte from 'rollup-plugin-svelte';
|
2025-03-28 14:16:20 +01:00
|
|
|
import resolve from '@rollup/plugin-node-resolve';
|
2020-11-11 00:00:54 +01:00
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
import livereload from 'rollup-plugin-livereload';
|
2023-09-14 12:29:06 +02:00
|
|
|
import terser from '@rollup/plugin-terser';
|
2023-09-19 14:35:35 +02:00
|
|
|
import babel from '@rollup/plugin-babel'
|
2024-08-30 15:16:01 +02:00
|
|
|
import typescript from '@rollup/plugin-typescript'
|
2024-08-30 16:17:48 +02:00
|
|
|
import { sveltePreprocess } from 'svelte-preprocess';
|
2020-11-11 00:00:54 +01:00
|
|
|
|
|
|
|
const production = !process.env.ROLLUP_WATCH;
|
|
|
|
|
|
|
|
const builddir = "../res/static/svelte"
|
|
|
|
export default [
|
2021-05-18 23:47:38 +02:00
|
|
|
"file_viewer",
|
2020-11-11 00:00:54 +01:00
|
|
|
"filesystem",
|
2021-09-21 21:39:28 +02:00
|
|
|
"user_home",
|
2021-05-25 22:15:29 +02:00
|
|
|
"admin_panel",
|
2021-06-22 17:14:21 +02:00
|
|
|
"home_page",
|
2022-02-21 23:25:44 +01:00
|
|
|
"text_upload",
|
2024-02-19 19:49:34 +01:00
|
|
|
"speedtest",
|
2024-06-13 21:17:41 +02:00
|
|
|
"upload_history",
|
2025-03-25 17:58:26 +01:00
|
|
|
"login",
|
2020-11-11 00:00:54 +01:00
|
|
|
].map((name, index) => ({
|
|
|
|
input: `src/${name}.js`,
|
|
|
|
output: {
|
|
|
|
sourcemap: true,
|
|
|
|
format: 'iife',
|
|
|
|
name: 'app',
|
2023-09-14 12:29:06 +02:00
|
|
|
file: `${builddir}/${name}.js`,
|
2020-11-11 00:00:54 +01:00
|
|
|
},
|
|
|
|
plugins: [
|
2024-11-19 15:31:51 +01:00
|
|
|
sveltePreprocess(),
|
|
|
|
|
2020-11-11 00:00:54 +01:00
|
|
|
svelte({
|
2024-08-30 16:17:48 +02:00
|
|
|
preprocess: sveltePreprocess(),
|
2023-09-14 12:29:06 +02:00
|
|
|
compilerOptions: {
|
|
|
|
// enable run-time checks when not in production
|
|
|
|
dev: !production,
|
|
|
|
},
|
|
|
|
emitCss: false,
|
2020-11-11 00:00:54 +01:00
|
|
|
}),
|
|
|
|
|
2023-09-19 14:35:35 +02:00
|
|
|
babel({
|
2024-09-11 14:18:03 +02:00
|
|
|
extensions: [".js", ".ts", ".svelte"],
|
2023-09-19 14:35:35 +02:00
|
|
|
babelHelpers: "bundled",
|
|
|
|
}),
|
|
|
|
|
2024-09-11 14:18:03 +02:00
|
|
|
// If you have external dependencies installed from npm, you'll most
|
|
|
|
// likely need these plugins. In some cases you'll need additional
|
|
|
|
// configuration - consult the documentation for details:
|
2020-11-11 00:00:54 +01:00
|
|
|
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
|
|
|
resolve({
|
|
|
|
browser: true,
|
2023-09-14 12:29:06 +02:00
|
|
|
exportConditions: ['svelte'],
|
2025-03-28 14:16:20 +01:00
|
|
|
modulePaths: [process.cwd() + "/src", process.cwd() + "/node_modules"],
|
|
|
|
extensions: [".svelte", ".mjs", ".js", ".json", ".mts", ".ts"],
|
2020-11-11 00:00:54 +01:00
|
|
|
}),
|
|
|
|
commonjs(),
|
2025-03-27 15:10:59 +01:00
|
|
|
typescript(),
|
2020-11-11 00:00:54 +01:00
|
|
|
|
2024-09-11 14:18:03 +02:00
|
|
|
// Watch the `public` directory and refresh the browser on changes when
|
|
|
|
// not in production
|
2020-11-11 00:00:54 +01:00
|
|
|
!production && livereload({
|
|
|
|
watch: `${builddir}/${name}.*`,
|
|
|
|
port: 5000 + index,
|
|
|
|
}),
|
|
|
|
|
2024-09-11 14:18:03 +02:00
|
|
|
// If we're building for production (npm run build instead of npm run
|
|
|
|
// dev), minify
|
2023-09-18 22:43:12 +02:00
|
|
|
production && terser(),
|
2020-11-11 00:00:54 +01:00
|
|
|
],
|
|
|
|
watch: {
|
|
|
|
clearScreen: false
|
2023-09-14 12:29:06 +02:00
|
|
|
},
|
2020-11-11 00:00:54 +01:00
|
|
|
}));
|