Files
fnx_web/svelte/rollup.config.js

86 lines
2.1 KiB
JavaScript
Raw Normal View History

import svelte from 'rollup-plugin-svelte';
2023-09-14 12:29:06 +02:00
import resolve, { nodeResolve } 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'
2024-09-05 17:28:31 +02:00
import includePaths from 'rollup-plugin-includepaths';
import { sveltePreprocess } from 'svelte-preprocess';
const production = !process.env.ROLLUP_WATCH;
const builddir = "../res/static/svelte"
export default [
2021-05-18 23:47:38 +02:00
"file_viewer",
"filesystem",
2021-09-21 21:39:28 +02:00
"user_home",
2021-05-18 23:47:38 +02:00
"user_file_manager",
2021-05-25 22:15:29 +02:00
"admin_panel",
2021-06-22 17:14:21 +02:00
"home_page",
"text_upload",
2024-02-19 19:49:34 +01:00
"speedtest",
2024-06-13 21:17:41 +02:00
"upload_history",
].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: [
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({
2024-09-05 17:28:31 +02:00
extensions: [".js", ".ts", ".html", ".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'],
extensions: ['.svelte'],
}),
commonjs(),
2023-09-14 12:29:06 +02:00
nodeResolve(),
typescript({
compilerOptions: { lib: ["es2015", "dom"] },
verbatimModuleSyntax: true,
}),
2024-09-05 17:28:31 +02:00
includePaths({
paths: ["."],
}),
// In dev mode, call `npm run start` once
// the bundle has been generated
// !production && serve(),
// 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
},
}));