Comments (7)
It really depends.
Some developers want to apply watch
rules even for first build in "watch" mode, some developers as it turned out want to apply before
rules for first build in "watch" mode and watch
rules for subsequent "watch "builds. So, it's all really depends on programmer logic.
As for after
rules, these rules will be applied for both "normal" compilation and "watch" compilation. According to the 1.4.0 documentation:
after
– executes once after "normal" compilation and every time after "watch" compilation.
Anyway, you are right that webpack treats first build in "watch" mode as "normal" build, and next builds is just short rebuilds. Current watch
behavior for "watch" mode: apply same rules for first build and subsequent rebuilds.
You're not the first who asks for another behavior of watch
for "watch" mode: apply before
rules for first builds and watch
rules for subsequent rebuilds. According to "Insights > Traffic" people also google for it.
This is an obvious scenario, and i should have implemented this earlier. I will implement it in 1.4.1.
Thank you for request.
from remove-files-webpack-plugin.
Hello there!
I guess it is a (hacky) solution what you talking about - #22 (comment)
from remove-files-webpack-plugin.
Yes, thats the one.
Would you agree that the startup build for watch should be considered a normal build (in before/after)?
from remove-files-webpack-plugin.
Starting from 1.4.1 you can use such configuration:
new RemovePlugin({
// will be applied for every "normal" build and
// for first build of "watch" build
before: {
// ...
},
// will be applied to each "watch" build,
// starting from the second one
watch: {
// ...
beforeForFirstBuild: true
}
})
from remove-files-webpack-plugin.
I'm closing this. Feel free to reopen if you have any questions/features/bugs relative to this issue.
from remove-files-webpack-plugin.
Hi @Amaimersion thanks for the update, working as expected!
You might want to add an example to the documentation, like:
// Remove distfolder all normal builds and first watch build.
new RemovePlugin({
before: {
include: [
'./Content/dist'
]
},
watch: {
beforeForFirstBuild: true
}
})
from remove-files-webpack-plugin.
I thought about adding some example with beforeForFirstBuild
in readme. However, beforeForFirstBuild
looks too simple and i think parameters description is enough to document this parameter. Current examples section contains only few simple cases for demonstration and some hard cases for additional documentation. If i will add many simple cases in examples section, then examples section will become "too much" and no one will read it. So, it is the reasons why i didn't add it.
from remove-files-webpack-plugin.
Related Issues (20)
- may I turn off the error notice when the file not exist? HOT 5
- Change logging behavior HOT 3
- TS typing? HOT 5
- 'An items for permanent removing not found' HOT 5
- incorrect escaping of root folder path HOT 7
- Files not being removed, unsafe to remove warning in terminal HOT 3
- Keep generated files when in watch mode HOT 11
- Fix wording of error message HOT 4
- Cannot silence logs via `stats` in webpack config HOT 2
- Option `Trash` being async HOT 1
- Error: EISDIR: illegal operation on a directory, copyfile HOT 2
- symlinks always traversed HOT 1
- Breaking change in 1.5.0 - webpack types require webpack 5 HOT 4
- Moderate vulnerability trash 7.2.0
- item undefined bug HOT 2
- Skipped, because unsafe removing HOT 3
- Method isSave not working properly
- Improve documentation HOT 2
- before not working in watch mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remove-files-webpack-plugin.