Advertisement
wizard9287

Untitled

Apr 6th, 2020
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import svelte from "rollup-plugin-svelte";
  2. import resolve from "rollup-plugin-node-resolve";
  3. import commonjs from "rollup-plugin-commonjs";
  4. import scss from "rollup-plugin-scss";
  5. import livereload from "rollup-plugin-livereload";
  6. import { autoPreprocess } from "svelte-preprocess/dist/autoProcess";
  7. import { terser } from "rollup-plugin-terser";
  8. import del from "rollup-plugin-delete";
  9.  
  10. const production = !process.env.ROLLUP_WATCH;
  11. const port = process.env.PORT;
  12. const buildDir = "public/dist";
  13.  
  14. export default {
  15.     input: "src/index.js",
  16.     output: {
  17.         name: "app",
  18.         format: "esm",
  19.         sourcemap: !production,
  20.         dir: `${buildDir}`,
  21.     },
  22.     manualChunks(id) {
  23.         if (id.includes("node_modules")) {
  24.             return "vendor";
  25.         }
  26.     },
  27.     plugins: [
  28.         del({
  29.             targets: "public/dist/*",
  30.             runOnce: true,
  31.         }),
  32.         svelte({
  33.             dev: !production,
  34.             emitCss: true,
  35.             preprocess: autoPreprocess({ postcss: true }),
  36.         }),
  37.         scss({ output: `${buildDir}/bundle.css` }),
  38.         resolve({
  39.             browser: true,
  40.             dedupe: ["svelte"],
  41.         }),
  42.         commonjs(),
  43.         !production &&
  44.             livereload({
  45.                 watch: "public",
  46.             }),
  47.         production && terser(),
  48.     ],
  49.  
  50.     watch: {
  51.         clearScreen: false,
  52.     },
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement