Skip to content

Commit

Permalink
fix: invalidate files when they're changed
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Jan 29, 2019
1 parent e9cfae9 commit cb34c08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 3 additions & 0 deletions packages/rollup/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ module.exports = (opts) => {
`Any plugins defined during the "done" lifecycle won't run when "styleExport" is set!`
);
}

// Watch any files already in the procesor
Object.keys(processor.files).forEach((file) => this.addWatchFile(file));
},

watchChange(file) {
Expand Down
15 changes: 8 additions & 7 deletions packages/svelte/svelte.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ module.exports = (config = false) => {

if(style) {
log("extract <style>");

file = "<style>";


if(processor.has(filename)) {
processor.invalidate(filename);
}

result = await processor.string(
filename,
style[1]
Expand Down Expand Up @@ -102,11 +106,8 @@ module.exports = (config = false) => {

log("extract <link>", external);

// When cleaning remove any files that've already been encountered, they need to be re-processed
if(config.clean) {
if(external in processor.files) {
[ ...processor.dependents(external), external ].forEach((entry) => processor.remove(entry));
}
if(processor.has(external)) {
processor.invalidate(external);
}

// Process the file
Expand Down

0 comments on commit cb34c08

Please sign in to comment.