This repository has been archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 810
Do not watch Rollup config file #199
Comments
Can confirm this on linux |
As a workaround on linux, you can change the
NB: You will need bash installed in order for this to work.
I'll love to see a better solution |
This removes the need for bash: function serve() {
let server;
function toExit() {
if (server) {
try {
spawn("kill", ["--", `-${server.pid}`]);
} catch (error) {
console.log(error.message);
server.kill();
}
}
}
return {
writeBundle() {
if (server) return;
server = spawn("yarn", ["start", "--dev"], {
stdio: ["inherit", "inherit", "inherit"],
detached: true,
});
process.on("SIGTERM", toExit);
process.on("exit", toExit);
},
closeWatcher: toExit,
};
} Starting the server in a detached process makes sure that the PID of server is also the PGID of all of it's children. Then passing the negation (-) of server PID to |
ranjan-purbey
added a commit
to ranjan-purbey/template
that referenced
this issue
Jan 22, 2021
Fixes sveltejs#199 Rollup reloads the config on detecting changes in it. This should also restart the `sirv` server. But the current config keeps creating new instances of `sirv` on each reload without properly stopping the previous ones. This PR fixes that behaviour.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Any changes made to
rollup.config.js
automatically triggers Rollup to rebuild itself. This reinvokes the entireplugins[]
list, which not only can be slow, but reinitializes a newsirv
process.Because Rollup clears reference to its previous
rollup.config.js
, theserver
reference resets toundefined
, forcing a new server subprocess.After a few modifications to my config, I saw I had 16
node
processes running in Activity Monitor.Then after shutting down
dev
script, 3node
s remain, meaning that the Rollup resets make it possible for ournpm start
subprocesses to be detached.Logs
The text was updated successfully, but these errors were encountered: