aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

TypeError: Cannot read property 'substr' of undefined #90

Closed mbroadst closed 8 years ago

mbroadst commented 8 years ago

No idea what's going on here, seems different than https://github.com/aurelia/bundler/issues/79, any tips would be greatly appreciated.

[14:24:33] 'bundle' errored after 555 ms
[14:24:33] Error on fetch for app.html at file:///Users/mbroadst/Development/hive/dashboard/dist/app.html
    TypeError: Cannot read property 'substr' of undefined
    at fromFileURL (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/lib/utils.js:58:13)
    at SystemJSNodeLoader.<anonymous> (/Users/mbroadst/Development/hive/dashboard/node_modules/aurelia-bundler/dist/bundler.js:83:86)
    at SystemJSNodeLoader.loader.fetch (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/lib/builder.js:170:59)
    at /Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/lib/trace.js:374:23
    at tryCatcher (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:503:31)
    at Promise._settlePromise (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:560:18)
    at Promise._settlePromise0 (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:605:10)
    at Promise._settlePromises (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:684:18)
    at Async._drainQueue (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:126:16)
    at Async._drainQueues (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:136:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/mbroadst/Development/hive/dashboard/node_modules/systemjs-builder/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
mbroadst commented 8 years ago

The error seems to stem from this line of code: https://github.com/aurelia/bundler/blob/master/dist/bundler.js#L83

I haven't traced back far enough yet, but this is being called for a top level app.html file in my src dir, where load in this case is:

{ name: 'file:///Users/mbroadst/Development/hive/dashboard/dist/app.html',
  metadata: {},
  address: 'file:///Users/mbroadst/Development/hive/dashboard/dist/app.html' }
mbroadst commented 8 years ago

This looks like I forgot to change [*] to [*.js] in my bundles.json, sorry for the noise but hopefully it might be helpful to users in the future!

aaronroberson commented 8 years ago

@mbroadst This helped me, so your hopes were made reality ;)

alexmills commented 8 years ago

@mbroadst you're a life saver mate, nice work!