diff options
Diffstat (limited to 'rollup.config.js')
-rw-r--r-- | rollup.config.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..2f97184 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,58 @@ +import svelte from 'rollup-plugin-svelte'; +import commonjs from '@rollup/plugin-commonjs'; +import resolve from '@rollup/plugin-node-resolve'; +import nodeResolve from "@rollup/plugin-node-resolve"; +import replace from "@rollup/plugin-replace"; +import livereload from 'rollup-plugin-livereload'; +import { terser } from 'rollup-plugin-terser'; +import css from 'rollup-plugin-css-only'; +import postcss from 'rollup-plugin-postcss'; +import autoPreprocess from 'svelte-preprocess'; + +const production = !process.env.ROLLUP_WATCH; + +export default { + input: 'src_frontend/main.js', + output: { + sourcemap: true, + format: 'iife', + name: 'app', + file: 'public/build/bundle.js' + }, + plugins: [ + svelte({ + compilerOptions: { + // enable run-time checks when not in production + dev: !production + }, + preprocess: autoPreprocess() + }), + // we'll extract any component CSS out into + // a separate file - better for performance + css({ output: 'bundle.css' }), + + // 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, + dedupe: ['svelte'] + }), + nodeResolve({ + browser: true + }), + replace({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) + }), + commonjs(), + + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser() + ], + watch: { + clearScreen: false + } +}; |