question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Doesn't work with rollup-plugin-serve

See original GitHub issue

My rollup config:

import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';

export default {
  entry: `src/index.js`,
  dest: `docs/script.js`,

  plugins: [
    serve({
      open: true,
      contentBase: `docs`,
    }),
    livereload()
  ],

  format: `iife`
};

Then, I run rollup --config --watch. The app loads on port 10001, but it doesn’t livereload upon bundle changes. In fact, the bundle doesn’t get compiled at all anymore! Removing this plugin fixes everything.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ghostcommented, Aug 24, 2018

@homerjam Short summary: Rollup watches src folder, and rebuilds files into dist when files in src changed. This plugin watches dist folder, and reloads browser when files in dist changed.

3reactions
JamesTheHackercommented, Nov 5, 2017

Works for me guys. Not sure if my config is of any use but I’ll share it anyway. It also reloads sass 😃

import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import livereload from 'rollup-plugin-livereload';
import serve from 'rollup-plugin-serve';
import commonjs from 'rollup-plugin-commonjs';
import postcss from 'rollup-plugin-postcss';
import sass from 'node-sass';
import cssnano from 'cssnano';
import path from 'path';

const cssExportMap = {};

export default {
  input: 'src/main.js',
  output: {
    file: 'dist/app.js',
    format: 'iife'
  },
  plugins: [
    postcss({
      preprocessor: (content, id) => new Promise((resolve, reject) => {
        const result = sass.renderSync({ file: id })
        resolve({ code: result.css.toString() })
      }),
      plugins: [
        cssnano(),
      ],
      sourceMap: false,
      extract: true,
      extensions: [ '.css', '.scss', '.sass' ],
    }),
    commonjs({
      namedExports: {
        'node_modules/validate.js/validate': [ 'validate' ]
      }
    }),
    resolve(),
    babel({
      exclude: [
        './node_modules/**',
        './src/css/**',
      ],
    }),
    serve('dist'),
    livereload({
      watch: [ 
        path.resolve(__dirname, 'dist'),
        path.resolve(__dirname, 'src')
      ],
      exts: [ 'html', 'js', 'scss', 'sass', 'css' ]
    }),
  ]
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

rollup-plugin-serve - npm
Start using rollup-plugin-serve in your project by running `npm i rollup-plugin-serve`. There are 158 other projects in the npm registry ...
Read more >
rollup-plugin-serve/README.md - UNPKG
1, # Rollup plugin to serve the bundle. 2. 3, <a href="LICENSE">. 4, <img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="Software ...
Read more >
Rollup Plugin Serve History API Fallback not working
i am using rollup for my svelte app. I install the package rollup-plugin-serve from npm to us the historyApiFallback so i can serve...
Read more >
Dev Server: Using plugins - Modern Web
These variables are not defined in the browser and will crash. ... The fromRollup function will convert a rollup plugin to a compatible...
Read more >
rollup-plugin-server - npm Package Health Analysis - Snyk
Security issues were found while scanning the latest version of rollup-plugin-server, and a total of 1 vulnerabilities were detected. It is highly advised ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found