Giter Site home page Giter Site logo

Comments (7)

Amaimersion avatar Amaimersion commented on June 8, 2024 1

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.

Amaimersion avatar Amaimersion commented on June 8, 2024

Hello there!

I guess it is a (hacky) solution what you talking about - #22 (comment)

from remove-files-webpack-plugin.

ansbar avatar ansbar commented on June 8, 2024

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.

Amaimersion avatar Amaimersion commented on June 8, 2024

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.

Amaimersion avatar Amaimersion commented on June 8, 2024

I'm closing this. Feel free to reopen if you have any questions/features/bugs relative to this issue.

from remove-files-webpack-plugin.

ansbar avatar ansbar commented on June 8, 2024

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.

Amaimersion avatar Amaimersion commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.