browserify / watchify

watch mode for browserify builds
Other
1.79k stars 203 forks source link

watchify -o '...' behaves strange #341

Closed serapath closed 7 years ago

serapath commented 7 years ago

How to pipe watchify?

  "scripts": {
    "watch": "watchify src/index.js -o 'npm run postprocess'",
    "postprocess": "tee > bundle.js",
    "build": "browserify src/index.js | npm run postprocess"
  }

It seems to be interpreted as a file name instead of a command. How can I prevent that? Is that maybe an issue for:

also: it throws sometimes when plugins/transforms are involved.

I'm using browserify-reload and uglifyify plugin for browserify/watchify

With other plugins/transforms i sometimes get another proble, when I'm specifying a command instead of a filename in watchifies -o '...' option.

e.g.

How can i debug that? Is this easy to fix? Am I doing something wrong?

serapath commented 7 years ago

Ok, i figured out it works (...don't know if in general) if I prefix the command with a | character, so:

  "scripts": {
    "watch": "watchify src/index.js -o '| npm run postprocess'",
    "postprocess": "tee > bundle.js",
    "build": "browserify src/index.js | npm run postprocess"
  }

makes npm run watch work as expected