Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

How to skip files rebuild everytime the app runs in dev mode? #55

Closed
keyserfaty opened this issue Jan 19, 2016 · 8 comments
Closed

How to skip files rebuild everytime the app runs in dev mode? #55

keyserfaty opened this issue Jan 19, 2016 · 8 comments

Comments

@keyserfaty
Copy link

Is there anyway I can skip the files being rebuild every time the build runs? I don't see why I would want that in files that haven't change. Am I missing something?
Thanks 馃憤

@alexander-akait
Copy link
Member

@keyserfaty why your need this feature? Webpack v2 and above using cache for loaders by default and don't emit files if they not changed.

@buzinas
Copy link

buzinas commented Jun 30, 2017

@evilebottnawi I use webpack 3 already, and what you're saying doesn't happen at all.

Every time I touch a css file which has a reference to a .png file (for background, for example), the file-loader emits the png file again and again.

Most of the files in my project takes 200~500ms to rebuild when watching, but some of them which have many PNG files referenced on it, sometimes it takes > 5s, it's awful.

@alexander-akait
Copy link
Member

@buzinas hm, yes, I'll try to find a solution, but I think it's related more to css-loader, than file-loader

@michael-ciniawsky
Copy link
Member

+ const cache = {}

 if (options.emitFile === undefined || options.emitFile) {
   // Don't emit the file again
+ if (cache[outputPath]) return

+ cache[outputPath] = true
  this.emitFile(outputPath, content);
 }

?

@michael-ciniawsky
Copy link
Member

Please test and try out #213

@buzinas
Copy link

buzinas commented Feb 21, 2018

Why was this closed even though it wasn't fixed?

@michael-ciniawsky
Copy link
Member

It's not possible to fix this within file-loader the e.g compiler.(Input|Output)FileSystem etc need to handle this instead. file-loader just pushes the file contents to module.assets and takes care of the rewriting the file paths, no convenient way to fix this here

@alexander-akait
Copy link
Member

@buzinas Yes should be fixed in webpack, feel free to create issue in webpack 馃憤

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants