sighjs / sigh

multi-process expressive build system for the web and node.js, built using baconjs observables
209 stars 12 forks source link

TypeError: Cannot read property 'map' of undefined #39

Closed jmatsushita closed 8 years ago

jmatsushita commented 8 years ago

I'm getting this error message without further information...

$ sigh build-test -vvvvv
 * running pipelines [ build-test ] with 3 jobs
 * waiting for subprocesses to start
 * subprocesses started in 0.852 seconds
 ! error: pipeline build-test
 ! TypeError: Cannot read property 'map' of undefined
 * pipeline(s) complete: 4.103 seconds

It happens with a large file tree and I think in the write plugin.

jmatsushita commented 8 years ago

Ok I've isolated this strange problem but I'm not sure yet what's causing it:

source
├── css
│   └── two.css
└── one.md
  pipelines['build-css'] = [
    glob({ basePath: 'source' }, '**/*.*'),
    debug(),
    write('dest')
  ]
$ sigh build-css
add: source/css/two.css
add: source/one.md
 ! error: pipeline build-css
 ! TypeError: Cannot read property 'map' of undefined

If I rename two.css -> two.md then it works.

jmatsushita commented 8 years ago

Seems like this line https://github.com/sighjs/sigh/blob/master/src/plugin/write.js#L63 is throwing the error. So it's related to the code expecting a sourcemap for the css file.

insidewhy commented 8 years ago

I have a fix almost ready for this, coincidentally someone raised it today but via a different manifestation.

insidewhy commented 8 years ago

This should be fixed in the latest version, let me know if it isn't and I can apply this PR. Thanks!

joelanders commented 8 years ago

jmatsushita's fix in his PR works for me.

insidewhy commented 8 years ago

@joelanders and the latest version of sigh with the latest sigh-core peer dependency does not?

insidewhy commented 8 years ago

@joelanders I think @jmatsushita's patch is wrong and will break source maps in other instances.

jmatsushita commented 8 years ago

I confirm that my patch is wrong and also that the latest version (sigh@0.12.28 ) doesn't solve the problem with the test above

insidewhy commented 8 years ago

Ah this is a duplicate of https://github.com/sighjs/sigh-core/issues/3