|
| 1 | +// this file will not afect the sandbox but will |
| 2 | +// afect the deployment and dowload |
| 3 | + |
| 4 | +import svelte from 'rollup-plugin-svelte'; |
| 5 | +import resolve from 'rollup-plugin-node-resolve'; |
| 6 | +import commonjs from 'rollup-plugin-commonjs'; |
| 7 | +import { terser } from 'rollup-plugin-terser'; |
| 8 | +import replace from '@rollup/plugin-replace'; |
| 9 | + |
| 10 | +const production = !process.env.ROLLUP_WATCH; |
| 11 | + |
| 12 | +export default { |
| 13 | + input: 'dev/index.js', |
| 14 | + output: { |
| 15 | + sourcemap: true, |
| 16 | + format: 'iife', |
| 17 | + name: 'app', |
| 18 | + file: 'public/bundle.js', |
| 19 | + }, |
| 20 | + plugins: [ |
| 21 | + svelte({ |
| 22 | + // enable run-time checks when not in production |
| 23 | + dev: !production, |
| 24 | + // we'll extract any component CSS out into |
| 25 | + // a separate file — better for performance |
| 26 | + css: (css) => { |
| 27 | + css.write('public/bundle.css'); |
| 28 | + }, |
| 29 | + }), |
| 30 | + |
| 31 | + // If you have external dependencies installed from |
| 32 | + // npm, you'll most likely need these plugins. In |
| 33 | + // some cases you'll need additional configuration — |
| 34 | + // consult the documentation for details: |
| 35 | + // https://github.com/rollup/rollup-plugin-commonjs |
| 36 | + resolve(), |
| 37 | + commonjs(), |
| 38 | + |
| 39 | + // If we're building for production (npm run build |
| 40 | + // instead of npm run dev), minify |
| 41 | + production && terser(), |
| 42 | + |
| 43 | + replace({ |
| 44 | + 'process.env.NODE_ENV': JSON.stringify('production'), |
| 45 | + include: '**/node_modules/**', |
| 46 | + }), |
| 47 | + ], |
| 48 | +}; |
0 commit comments