Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using plugin serve with watch option #8

Closed
NoxWings opened this issue Jul 19, 2017 · 5 comments
Closed

Using plugin serve with watch option #8

NoxWings opened this issue Jul 19, 2017 · 5 comments

Comments

@NoxWings
Copy link

NoxWings commented Jul 19, 2017

I'm not sure if I'm using this incorrectly or it is a "bug".
I'm trying to use this plugin with the watch option. The first time it runs ok, It looks like the socket is kept open. The second time I run the build it reports the port is already in use.

It only happens while using the watch option but it is completely fine without it.

Here is my rollup.config.js

import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import uglify from "rollup-plugin-uglify";
import serve from "rollup-plugin-serve";
import livereload from "rollup-plugin-livereload";


const DISTFOLDER = "dist";

export default {
    entry: "src/main.js",
    format: "iife",
    moduleName: "app",
    plugins: [
        resolve({ jsnext: true, main: true }),
        commonjs(),
        babel({ exclude: "node_modules/**" }),
        uglify(),
        serve({ contentBase: DISTFOLDER,  port: 8080 }),
        livereload({ watch: DISTFOLDER })
    ],
    external: [],
    dest: `${DISTFOLDER}/bundle.js`
};
@NoxWings
Copy link
Author

NoxWings commented Jul 19, 2017

I've just noticed something:

1.- Running rollup -c then Ctrl+C to stop the server works ok as expected.
2.- Running rollup -c -w I have to Ctrl+C twice... but it works. The socket is freed.
3.- Running it through npm with npm run dev I only have to Ctrl+C once but the socket is not freed.

"scripts": {
    "dev": "rollup -c -w --sourcemap",
}

@thgh
Copy link
Owner

thgh commented Aug 1, 2017

Thanks for reporting 😃

I'm not sure how to fix it. PRs welcome!

@vinjoel
Copy link
Contributor

vinjoel commented Aug 15, 2017

Submitted a PR to close the server when termination signals are encountered

@andrejcremoznik
Copy link

What's the holdup for releasing this to npm?

@thgh
Copy link
Owner

thgh commented Aug 21, 2017

Time ;-) Also, I'm not using rollup frequently nowadays.

The package has been published.

@thgh thgh closed this as completed Aug 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants