Files
fnx_web/svelte/rollup.config.js

73 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

import svelte from 'rollup-plugin-svelte';
import resolve from '@rollup/plugin-node-resolve';
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';
import babel from '@rollup/plugin-babel'
import typescript from '@rollup/plugin-typescript'
import { sveltePreprocess } from 'svelte-preprocess';
const production = !process.env.ROLLUP_WATCH;
const builddir = "../res/static/svelte"
export default [
"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",
2024-02-19 19:49:34 +01:00
"speedtest",
2025-03-25 17:58:26 +01:00
"login",
].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`,
},
plugins: [
2024-11-19 15:31:51 +01:00
sveltePreprocess(),
svelte({
preprocess: sveltePreprocess(),
2023-09-14 12:29:06 +02:00
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
},
emitCss: false,
}),
babel({
extensions: [".js", ".ts", ".svelte"],
babelHelpers: "bundled",
}),
// 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:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
2023-09-14 12:29:06 +02:00
exportConditions: ['svelte'],
modulePaths: [process.cwd() + "/src", process.cwd() + "/node_modules"],
extensions: [".svelte", ".mjs", ".js", ".json", ".mts", ".ts"],
}),
commonjs(),
2025-03-27 15:10:59 +01:00
typescript(),
// Watch the `public` directory and refresh the browser on changes when
// not in production
!production && livereload({
watch: `${builddir}/${name}.*`,
port: 5000 + index,
}),
// 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(),
],
watch: {
clearScreen: false
2023-09-14 12:29:06 +02:00
},
}));