browserify / wzrd.in

browserify as a service.
http://wzrd.in
MIT License
637 stars 96 forks source link

destructuring doesnt work, but works natively in my chrome browser #151

Open serapath opened 7 years ago

serapath commented 7 years ago

I was trying to execute

var demoCA = require('demo-ca')
var element = demoCA({ theme: { color: 'yellow' } })
document.body.appendChild(element)

in requirebin.com and it seems that might be related to wzrd.in?

Bundling error: 

---FLAGRANT SYSTEM ERROR---

--- error #0: ---

(logs uuid: 01b53e40-b6e5-11e6-9e69-517afb79b957 )

Error: "browserify exited with code 1"

code: 1
stderr: ReferenceError: Invalid left-hand side in assignment
    at module.exports (/home/admin/browserify-cdn/node_modules/browserify/node_modules/syntax-error/index.js:13:52)
    at DestroyableTransform._transform (/home/admin/browserify-cdn/node_modules/browserify/index.js:583:19)
    at DestroyableTransform.Transform._read (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_transform.js:172:12)
    at Labeled.Pipeline._write (/home/admin/browserify-cdn/node_modules/browserify/node_modules/labeled-stream-splicer/node_modules/stream-splicer/index.js:73:22)
    at doWrite (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:279:12)
    at writeOrBuffer (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:266:5)
    at Labeled.Writable.write (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:211:11)
    at Labeled.ondata (/home/admin/browserify-cdn/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:572:20)
    at emitOne (events.js:77:13)

dirPath: /tmp/demo-ca1161030-16116-14oh3o5

------

This is probably an issue with the package, and not browserify-cdn itself.
If you feel differently, feel free to file a bug report at:

    https://github.com/jfhbrook/browserify-cdn/issues

Include the ENTIRETY of the contents of this message, and the maintainer(s)
can try to help you out.

Have a nice day!
jfhbrook commented 7 years ago

wzrd.in runs on an old version of node. If the demo-ca library depends on es6 features, this would probably be why you're seeing this.

I'm open to upgrading (probably about time). @maxogden thoughts there?

serapath commented 7 years ago

It's basically about:


// function demoCA ({ // NOT SUPPORTED YET
//   theme : { color : color = '#00ffff' }   = {},
//   data  : { name  : name  = 'anonymous' } = {}
// } = {}) {
function demoCA (params) {
  var color = ((params||{}).theme||{}).color || '#00ffff'
  var name  = ((params||{}).data ||{}).name  || 'anonymous'

... switching the former for the latter made things work.