Blitz: `blitz start` broken in 0.8.0-canary.4

Created on 1 May 2020  ·  9Comments  ·  Source: blitz-js/blitz

What is the problem?

Steps to Reproduce:

  1. yarn global add [email protected]
  2. blitz new myapp
  3. cd myapp
  4. blitz start
  5. Fails with
/t/a1> blitz s
You are using alpha software - if you have any problems, please open an issue here:
  https://github.com/blitz-js/blitz/issues/new/choose

◢ Preparing for launchError: File not found with singular glob: /private/tmp/a1/node_modules/npm-normalize-package-bin//bin/ (if this was purposeful, use `allowEmpty` option)
    at Glob.<anonymous> (/private/tmp/a1/node_modules/glob-stream/readable.js:84:17)
    at Object.onceWrapper (events.js:417:26)
    at Glob.emit (events.js:310:20)
    at Glob.EventEmitter.emit (domain.js:482:12)
    at Glob._finish (/private/tmp/a1/node_modules/glob/glob.js:197:8)
    at done (/private/tmp/a1/node_modules/glob/glob.js:182:14)
    at Glob._processSimple2 (/private/tmp/a1/node_modules/glob/glob.js:688:12)
    at /private/tmp/a1/node_modules/glob/glob.js:676:10
    at Glob._stat2 (/private/tmp/a1/node_modules/glob/glob.js:772:12)
    at lstatcb_ (/private/tmp/a1/node_modules/glob/glob.js:764:12)

Maybe this is related to changes in #365?

Weird workaround

  1. rm -rf node_modules
  2. yarn
  3. blitz start -> works

cc @ryardley @Skn0tt

kinbug priorithigh scopserver

All 9 comments

@Skn0tt it seems the gitignore check is crawling the file system to and compiling a list of all ignored files. Is that what it's doing?

Yup. Didn't know about the allowEmpty option 🙈 I'm gonna provide a PR real quick

As can be seen from the stack trace, allowEmpty is an option on glob-stream, which is a dependency two layers below fast-glob. Let's see how we can interface with that 🧐

After some investigation, it seems like glob-stream is just a devDependency to fast-glob. The real reason we've got glob-stream is vinyl-fs:

$ yarn why glob-stream
=> Found "[email protected]"
info Reasons this module exists
   - "_project_#@blitzjs#server#vinyl-fs" depends on it
   - Hoisted from "_project_#@blitzjs#server#vinyl-fs#glob-stream"

Found the root-cause, it is indeed related to #365: Gitignore entries starting with a / make it stumble. Weird, I thought I'd tested for that.

Ok cool.

Is there a way can do this without actually reading all the gitignore files? Because it causes a performance hit on boot up

Nope, don't think so. #389 excludes node_modules from the glob search though, which should make the performance hit neglegible.

It'd be possible to further speed it up by doing an informed glob search based on already-found .gitignores, but I'd rather not add that complexity that until the performance hit is noticeable.

Ok, perfect. Thanks!

Was this page helpful?
0 / 5 - 0 ratings