browserify / watchify

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

Won't detect changes #144

Closed jarah closed 9 years ago

jarah commented 9 years ago

Have installed with

   npm install react browserify watchify 6to5ify --save-dev

Saw the following in the log

npm WARN package.json react-playground@1.0.0 No repository field.
npm WARN deprecated 6to5-core@3.6.5: 6to5 is now 'babel': https://babeljs.io/blog/2015/02/15/not-born-to-die

> fsevents@0.3.5 install /Users/John/WebstormProjects/react-playground/node_modules/watchify/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
  SOLINK_MODULE(target) Release/.node
  SOLINK_MODULE(target) Release/.node: Finished
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node
  SOLINK_MODULE(target) Release/fse.node: Finished
watchify@2.4.0 node_modules/watchify
├── through2@0.5.1 (xtend@3.0.0, readable-stream@1.0.33)
└── chokidar@0.12.6 (async-each@0.1.6, readdirp@1.3.0, fsevents@0.3.5)

browserify@9.0.3 node_modules/browserify
├── https-browserify@0.0.0
├── tty-browserify@0.0.0
├── builtins@0.0.7
├── constants-browserify@0.0.1
├── process@0.10.0
├── path-browserify@0.0.0
├── isarray@0.0.1
├── os-browserify@0.1.2
├── inherits@2.0.1
├── commondir@0.0.1
├── string_decoder@0.10.31
├── stream-browserify@1.0.0
├── defined@0.0.0
├── shell-quote@0.0.1
├── has@1.0.0
├── domain-browser@1.1.4
├── shallow-copy@0.0.1
├── xtend@3.0.0
├── duplexer2@0.0.2
├── deep-equal@1.0.0
├── assert@1.3.0
├── querystring-es3@0.2.1
├── timers-browserify@1.3.0
├── punycode@1.2.4
├── through2@1.1.1 (xtend@4.0.0)
├── util@0.10.3
├── events@1.0.2
├── vm-browserify@0.0.4 (indexof@0.0.1)
├── parents@1.0.1 (path-platform@0.11.15)
├── console-browserify@1.1.0 (date-now@0.1.4)
├── concat-stream@1.4.7 (typedarray@0.0.6)
├── url@0.10.2 (punycode@1.3.2)
├── subarg@1.0.0 (minimist@1.1.0)
├── http-browserify@1.7.0 (Base64@0.2.1)
├── shasum@1.0.1 (sha.js@2.3.6, json-stable-stringify@0.0.1)
├── readable-stream@1.1.13 (core-util-is@1.0.1)
├── browser-resolve@1.7.2
├── labeled-stream-splicer@1.0.2 (stream-splicer@1.3.1)
├── resolve@1.1.5
├── buffer@3.0.3 (ieee754@1.1.4, base64-js@0.0.8, is-array@1.0.1)
├── glob@4.4.0 (once@1.3.1, inflight@1.0.4, minimatch@2.0.1)
├── JSONStream@0.10.0 (through@2.3.6, jsonparse@0.0.5)
├── crypto-browserify@3.9.12 (randombytes@2.0.1, create-hmac@1.1.3, pbkdf2-compat@3.0.2,             create-hash@1.1.0, diffie-hellman@3.0.1, create-ecdh@1.0.3, browserify-aes@1.0.0, public-encrypt@1.1.2, browserify-sign@2.8.0)
├── deps-sort@1.3.5 (minimist@0.2.0, through2@0.5.1, JSONStream@0.8.4)
├── browser-pack@4.0.0 (umd@3.0.0, through2@0.5.1, JSONStream@0.8.4, combine-source-map@0.3.0)
├── insert-module-globals@6.2.0 (process@0.6.0, through@2.3.6, JSONStream@0.7.4, combine-source-map@0.3.0, lexical-scope@1.1.0)
├── syntax-error@1.1.2 (acorn@0.9.0)
├── browserify-zlib@0.1.4 (pako@0.2.5)
└── module-deps@3.7.2 (xtend@4.0.0, minimist@0.2.0, subarg@0.0.1, through2@0.4.2, stream-combiner2@1.0.2, JSONStream@0.7.4, detective@4.0.0)

6to5ify@4.1.1 node_modules/6to5ify
├── through@2.3.4
├── lodash@3.3.0
└── 6to5-core@3.6.5 (fs-readdir-recursive@0.1.0, supports-color@1.2.0, roadrunner@1.0.4, globals@5.1.0, js-tokenizer@1.3.3, private@0.1.6, commander@2.6.0, estraverse@1.9.1, esutils@1.1.6, debug@2.1.1, chalk@0.5.1, ast-types@0.6.14, output-file-sync@1.1.0, source-map@0.1.43, acorn-6to5@0.11.1-31, source-map-support@0.2.9, detect-indent@3.0.0, core-js@0.5.4,    regexpu@1.1.0, regenerator-6to5@0.8.10-1, lodash@3.0.0, useragent@2.1.5)

react@0.12.2 node_modules/react
└── envify@3.2.0 (through@2.3.6, jstransform@7.0.0)

In my package.json I have added the following

"scripts": {
    "watch": "watchify -t 6to5ify ./src/app.jsx -o ./dist/bundle.js -v"
  }

Have created a /dist folder, however when I try

npm run watch

It writes the first time, but doesn't subsequently trigger another build when app.jsx is changed. I'm using Webstorm to edit files. I'm on an old Macbook Pro with Snow Leapord.

Any ideas?

CodisRedding commented 9 years ago

:+1:

FREEZX commented 9 years ago

I had sort of the same issue, my issue was that i didn't correctly include the needed files in app.js.

zertosh commented 9 years ago

Nothing looks out of the ordinary. Can you provide more context?

kendagriff commented 9 years ago

+1

Here's my situation:

function scripts() {
  var bundler = watchify(browserify("./src/app.jsx", assign({
    extensions: [".jsx"]
  }, watchify.args)));

  bundler.transform(reactify);

  function bundle() {
    return bundler.bundle()
      .pipe(source("app.js"))
      .on("error", handleError)
      .pipe(buffer())
      .pipe(uglify())
      .pipe(gulp.dest("./public/dist/" + env + "/js"));
  }

  bundler.on("update", bundle);
  bundler.on("log", gutil.log);

  return bundle();
}

Same thing: works first load, but never calls the bundle() function again.

Running 2.6.0. Tried downgrading to a bunch of different watchify versions to no luck. Browserify version: 9.0.3.

zertosh commented 9 years ago

@kendagriff Nothing wrong jumps out at me, can you point me a repo I can clone?

sjcrank commented 9 years ago

I have created a repo with a minimal bit of code to reproduce the issue: https://github.com/sjcrank/watchify-issue144

zertosh commented 9 years ago

@sjcrank What you're seeing was a temporary issue in browserify@9.0.6, substack/node-browserify#1195 fixed it. So just reinstall watchify so that it pulls in browserify@9.0.7 and it all works.

sjcrank commented 9 years ago

Thanks @zertosh I have verified that with an npm update it is working fine.

kendagriff commented 9 years ago

There must be something wrong w/ my environment: if I even run watchify (3.1.0) from the command line on a single file, in verbose mode, it does not register changes to the file.

Is there an obvious dependency of mine that could be corrupted?