duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

Error when passing empty string into .entry() #484

Closed darsain closed 9 years ago

darsain commented 9 years ago

So I lost an hour on this :expressionless:. When you do:

new Duo(process.cwd()).entry('', 'css').run(console.log.bind(console))

You get:

Error: cannot find entry: source.css

Seems like you are not doing any type checking on this.raw or this.src throughout the code. Please use == null.

dominicbarnes commented 9 years ago

Gotcha, so if you happen to have an empty file, it freaks out?

darsain commented 9 years ago

Empty file, as in .entry('./empty.css') works properly => builds an empty result.

The error is thrown specifically in the case above: passing the raw contents of a file directly in 1st, and type hint in 2nd argument, so you are not touching the harddrive at all.

dominicbarnes commented 9 years ago

Gotcha! I'll take a look at this