Closed cousquer closed 5 years ago
Hello there đ
The technique used in the entirety of the ungap project is to create 100% cross environment modules, being this ESM, CJS, Workers, or plain HTML pages.
Almost every module starts like this:
var self = this || /* istanbul ignore next */ {};
this
would be undefined, hence the module is represented by an empty object that will be exported via export default self.moduleName
at the end.this
is the module itself already, so that the next statement will never happen, which is why there is an Istanbul directive to ignore it, otherwise it messes up with the coverage result. In this case, the module will be later on exported as module.exports = self.moduleName;
self = this
and the following object won't ever be created.The main, and only, gotcha with rollup is that it doesn't understand what's going on so that anything assigned to this
in a pseudo ESM/wannabe environment, should be converted into undefined.
In hyperHTML rollup config, I've specified both context: 'null'
and moduleContext: 'null'
so that the warning goes away, and no extra plugin should complain about a thing.
Does this solve your issue too?
Hello Andrea,
many many Thanks! đŻ You rock! đ đ
Additional Context
and no extra plugin should complain about a thing.
babel-minify was still flagging even with context: null
and was in neverLand...
[!] (babel-minify plugin) Error: Error transforming bundle with 'babel-minify' plugin: don't know how to turn this value into a node
Error: Error transforming bundle with 'babel-minify' plugin: don't know how to turn this value into a node
at Object.valueToNode (C:\Users\Cousquer\Documents\GitHub\CardWebComponents\node_modules\@babel\core\node_modules\@babel\types\lib\converters\valueToNode.js:103:9)
Resolution "Et hop lĂ !" => removed 34 packages in 3.477s
Many Thanks
Ciao Andrea,
I first wanted to thank you for hyperHTML (which I have been using since the very beginning in 2016). Your work is so stratospheric đ đ ... Many, many thanks. đ I always managed on my own, as soon as I had a little trouble. But here I am stuck. I really do not know if it's a bug on my side, on the hyperHTML side, or on the babel-minify/rollup side.
the bug(?)
on the project : https://github.com/cousquer/CardWebComponents see it live working [hyperHTML 2.16.0]: https://cousquer.github.io/CardWebComponents/ When I update hyperHTML in
package.json
hyperHTML from version 2.16.0 to 2.16.1, my build flags me: :triangular_flag_on_post:I do not understand anything about the error messages about istanbul??? I really don't know if it is on my side or on hyperHTML side?