single-spa / single-spa-html

A helper library for single-spa and vanilla html / web components
MIT License
10 stars 6 forks source link

Error check / object spread gets transpiled into the wrong order #2

Closed stephenwil closed 5 years ago

stephenwil commented 5 years ago

https://github.com/CanopyTax/single-spa-html/blob/6849095cd4640d17a21695518fa073eceff6ebf9/src/single-spa-html.js#L11

Is getting transpiled in your build to:

opts = Object.assign({}, opts, defaultOpts);

https://unpkg.com/single-spa-html@1.0.0/lib/single-spa-html.js

Such that the defaultOpts is trumping opts, and therefore the code errors out as it thinks no template is supplied.

Interesting to note, when it's built locally, babel is writing it as

opts = _objectSpread({}, defaultOpts, {}, opts);

which doesn't error. Rebuild/publish required?

joeldenning commented 5 years ago

Wow that's super weird I have no idea how the 1.0.0 published code ended up having that. I have a prepublishOnly hook that should guarantee that the code in my src directory is always compiled correctly before publish.

Either way, I have fixed this with https://github.com/CanopyTax/single-spa-html/releases/tag/v1.0.1. Thanks for the detailed issue description.