diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2022-07-17 23:29:58 -0400 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2022-07-17 23:29:58 -0400 |
| commit | e36e01917651ccfff64f948c36ee93d310071991 (patch) | |
| tree | 8f7e2f19980474689ef626d0f9906d0f1b197cac /rollup.config.js | |
| parent | 79242a197b79e7a3dc5a30925ecd7709093a6866 (diff) | |
| parent | 99aee9a7281aa9c5794cc062e41384dc3701906d (diff) | |
Merge pull request #1 from sahinf/tailwind
Tailwind
Diffstat (limited to 'rollup.config.js')
| -rw-r--r-- | rollup.config.js | 127 |
1 files changed, 67 insertions, 60 deletions
diff --git a/rollup.config.js b/rollup.config.js index 1cf4881..a4ce770 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -6,78 +6,85 @@ import { terser } from 'rollup-plugin-terser'; import sveltePreprocess from 'svelte-preprocess'; import typescript from '@rollup/plugin-typescript'; import css from 'rollup-plugin-css-only'; +import json from '@rollup/plugin-json'; const production = !process.env.ROLLUP_WATCH; function serve() { - let server; + let server; - function toExit() { - if (server) server.kill(0); - } + function toExit() { + if (server) server.kill(0); + } - return { - writeBundle() { - if (server) return; - server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { - stdio: ['ignore', 'inherit', 'inherit'], - shell: true - }); + return { + writeBundle() { + if (server) return; + server = require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { + stdio: ['ignore', 'inherit', 'inherit'], + shell: true + }); - process.on('SIGTERM', toExit); - process.on('exit', toExit); - } - }; + process.on('SIGTERM', toExit); + process.on('exit', toExit); + } + }; } export default { - input: 'src/main.ts', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'public/build/bundle.js' - }, - plugins: [ - svelte({ - preprocess: sveltePreprocess({ sourceMap: !production }), - compilerOptions: { - // enable run-time checks when not in production - dev: !production - } - }), - // we'll extract any component CSS out into - // a separate file - better for performance - css({ output: 'bundle.css' }), + input: 'src/main.ts', + output: { + sourcemap: true, + format: 'iife', + name: 'app', + file: 'public/build/bundle.js' + }, + plugins: [ + svelte({ + preprocess: sveltePreprocess({ + sourceMap: !production, + postcss: true, + }), + compilerOptions: { + // enable run-time checks when not in production + dev: !production + } + }), + // 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'] - }), - commonjs(), - typescript({ - sourceMap: !production, - inlineSources: !production - }), + // 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'] + }), + commonjs(), + typescript({ + sourceMap: !production, + inlineSources: !production + }), - // In dev mode, call `npm run start` once - // the bundle has been generated - !production && serve(), + // 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('public'), + // Watch the `public` directory and refresh the + // browser on changes when not in production + !production && livereload('public'), - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser() - ], - watch: { - clearScreen: false - } + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser(), + + // Reading from local json should only happen in development - Furkan + !production && json() + ], + watch: { + clearScreen: false + } }; |
