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

Rebuilds don't happen in watch mode after the first rebuild. #1669

Closed
trusktr opened this issue Oct 7, 2017 · 12 comments
Closed

Rebuilds don't happen in watch mode after the first rebuild. #1669

trusktr opened this issue Oct 7, 2017 · 12 comments

Comments

@trusktr
Copy link

trusktr commented Oct 7, 2017

Seems to be happening here too (it was previously happening to me with rollup-watch)

@talmobi
Copy link
Contributor

talmobi commented Oct 7, 2017

You could try npm install --save-dev chokidar. If I remember correctly rollup will use chokidar by default if it finds it in your node_modules ( instead of its own custom cocktail wrapper around fs.watch )

It's been some time since I used rollup ( using browserify again ) - but I did have pre v0.50.0 forked/private packages with working --watch that may work temporarily if the chokidar installation doesn't work out.

https://www.npmjs.com/package/@talmobi/rollup
https://www.npmjs.com/package/@talmobi/rollup-watch

@trusktr
Copy link
Author

trusktr commented Oct 8, 2017

No luck with chokidar.

@giovanniRodighiero
Copy link

Same problem here.
I got it working using the rollup.watch programmatically though, here's a simplified version of my watch script in case you interested:

const rollup = require('rollup');

const config = {
input: 'src/assets/index.js',
output: {
    file: './public/bundle.js',
    format: 'iife',
    sourcemap: true,
  },
watch: {
    chokidar: true,
    include: 'src/assets/**'
},
plugins: [...]
}

const watcher = rollup.watch(config);

watcher.on('event', event => {
  console.log(event.code)
  // event.code can be one of:
  //   START        — the watcher is (re)starting
  //   BUNDLE_START — building an individual bundle
  //   BUNDLE_END   — finished building a bundle
  //   END          — finished building all bundles
  //   ERROR        — encountered an error while bundling
  //   FATAL        — encountered an unrecoverable error
});

You'll have to run it "by hand" with node, like $ node rollup-watch-script.js

@aubergene
Copy link

Can you post an example repo to recreate the issue please

@ezze
Copy link

ezze commented Dec 8, 2017

I faced the same issue and created a repo to reproduce it. It uses both watch CLI flag and chokidar option in JavaScript API (based on @giovanniRodighiero's sample code). Further digging led me to stating the fact that the problem occurs only when files are changed in IDE. I use PhpStorm, and it creates temporary files on source files' change. When I disable safe write option in IDE settings everything works fine, at least for this small repo.

@aubergene
Copy link

Ah, yes it looks like "safe write" writes to a temporary file and then unlinks and links the file, which isn't triggering the change. Seems to occur for other projects too. @trusktr please can you confirm what editor you're using when this occurs.

@trusktr
Copy link
Author

trusktr commented Dec 8, 2017

I'm using NeoVim, and have it set not to write any temporary files anywhere in my project, as far as I know. All temporary files are written to ~/.vim, and AFAIK it only writes directly to files in the project.

Here's my repo: http://github.com/trusktr/infamous.

You can clone it, then npm install && npm run build-global -- -w which runs rollup -c with the -w option.

Then you can try editing a file multiple times and see if it starts failing.

EDIT: I've moved back to rollup, it has many new improvements. Still using Buble though, but Rollup with non-working watch mode was my main motivation to go back to Webpack. Plus Webpack has dynamic imports and other cool stuff, and the ModuleConcatenation effectively accomplishes what Rollup does.

@ghost
Copy link

ghost commented Dec 8, 2017

Hi there, I am facing the exact same issue, the watcher stops picking up changes after a seemingly arbitrary amount of time.

In my case I am watching on the output of the bucklescript compiler, which afaik writes directly to the disk too.

@trusktr
Copy link
Author

trusktr commented Dec 25, 2017

What I do to save time now, is to keep working on code while it is compiling, then my terminal makes a sound when a process finishes so I know when it finishes then I go test it, so I try to save time by either working on other code, or ☕️ . 😃

@trusktr
Copy link
Author

trusktr commented Dec 29, 2017

I just upgraded to Rollup 0.53.0 and the behavior is now worse. When I run rollup -c -w, the program exits after the first build and doesn't even try to watch anything. However, it does enter into the temporary buffer during the build, so when we return to the command line all the output is gone. It's just that Rollup exits and doesn't watch anything. 😕 Made a new issue for it: #1828

@shellscape
Copy link
Contributor

@trusktr if you have a spare moment, could you confirm that the latest version exhibits the same behavior?

(looks like this is similar to #1666)

@shellscape
Copy link
Contributor

Hey folks. This is a saved-form message, but rest assured we mean every word. The Rollup team is attempting to clean up the Issues backlog in the hopes that the active and still-needed, still-relevant issues bubble up to the surface. With that, we're closing issues that have been open for an eon or two, and have gone stale like pirate hard-tack without activity.

We really appreciate the folks have taken the time to open and comment on this issue. Please don't confuse this closure with us not caring or dismissing your issue, feature request, discussion, or report. The issue will still be here, just in a closed state. If the issue pertains to a bug, please re-test for the bug on the latest version of Rollup and if present, please tag @shellscape and request a re-open, and we'll be happy to oblige.

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

6 participants