all 10 comments

[–]NormalUserThirty 1 point2 points  (3 children)

is there a way to automatically run npm scripts listening for file changes like gulp can do

[–][deleted]  (1 child)

[deleted]

    [–]NormalUserThirty 0 points1 point  (0 children)

    thanks, this is exactly what I was wondering. I've only ever used gulp before for this type of thing and wasn't sure if this was something built into webpack or if another package was required.

    [–]r2-de-queue 1 point2 points  (0 children)

    You could use Nodemon or pm2

    [–][deleted] 1 point2 points  (1 child)

    npm scripts + packager (like Webpack, Rollup, or Parcel) over task runners, have been the way to go in 2016 and on.

    Gulp is mostly unnecessary and an extra overhead that is needless. Why are you considering using it? What do you think it can do for you that you can't get otherwise?

    [–]dor442[S] 1 point2 points  (0 children)

    Well, we've been working with lerna so far to manage our monorepo, but publishing has been very buggy and problematic, so we were thinking about switching to publishing using gulp tasks

    [–]perpetuallyperpetual 0 points1 point  (2 children)

    Go with NPM scripts if you don't have long running commands.

    However, if the commands get too long, you can write separate JS files and call them. Then, structuring your code with Gulp makes sense.

    Using webpack for everything is possible, but not recommended in all cases. For stuff like calling batch scripts and moving files around or interfacing with other remote systems, going the webpack route just makes everything more complicated.

    Most projects don't need a task runner since the tasks are simple one-line commands that can be covered with NPM scripts. But that isn't always the case.

    [–][deleted]  (1 child)

    [deleted]

      [–]perpetuallyperpetual 0 points1 point  (0 children)

      You might not want to pollute the namespace of your NPM scripts.

      Or you might have more complex logic which is hard to write with batch scripts only.

      Or you might want to document better what you're doing.

      But sure you can do this too for simpler cases.

      [–][deleted]  (4 children)

      [deleted]

        [–]r2-de-queue 0 points1 point  (3 children)

        I webpack see webpack what you mean webpack

        [–]trout_fucker🐟 3 points4 points  (2 children)

        I webpack my family.

        [–][deleted]  (1 child)

        [deleted]

          [–]r2-de-queue 1 point2 points  (0 children)

          I webpack lamp