WebReflection / hyperHTML

A Fast & Light Virtual DOM Alternative
ISC License
3.07k stars 112 forks source link

Add module to package.json #132

Closed ghost closed 7 years ago

ghost commented 7 years ago

Rollup and Webpack both use what is likely going to be the future standard for identifying the native ES6 module for a package: "module". Please add "module": "index.mjs" to your package.json.

WebReflection commented 7 years ago

I am not using .mjs but I will put the "module" as soon as I've refactored hyperHTML to 100% ESM compatible code.

Hopefully it's a matter of days

WebReflection commented 7 years ago

P.S. by "not using" I mean I have no plans to ship hyperHTML as .mjs for now ... it will stay as it is in V1 but it will be an ESM as .js in V2

ghost commented 7 years ago

You have an index.mjs file in the repo right now? The point of the module field is to do exactly what you are doing, expose a cjs file in main, and expose an ES6 module in module. There is also the "browser" field for versions bundled specifically for browser (IIFE, etc).

WebReflection commented 7 years ago

I know, no need to explain. All I am saying is that the .mjs file is going away soon but the "module" entry will be put there when V2 is out.

What is it that you cannot do with current CJS entry?

WebReflection commented 7 years ago

Also, please not right now the .mjs is not a proper ESM, it's a work around. The CJS is the best way to consume this module right now so please just use it as it is and wait for V2 to have proper ES2015+ syntax.

Thank you

ghost commented 7 years ago

Nothin :) But, to use HyperHTML with Rollup right now requires using the commonjs plugin to convert it to an ES6 module which is a little strange considering you actually have a native ES6 module available. Why are you abandoning the .mjs extension? It looks like that is going to be the defacto standard for ES6 modules moving forward.

Ah, you answered my question already. You don't think that .mjs will be the new standard. Fair enough, I know it is just a proposal right now.

WebReflection commented 7 years ago

Why are you abandoning the .mjs extension? It looks like that is going to be the defacto standard for ES6 modules moving forward.

You aren't following me on twitter much, I guess ... neither the discussion.

Node core will discuss the future of .mjs because nobody wants it and I am on pole position about it. https://codeburst.io/the-javascript-modules-limbo-585eedbb182e

Anyway, fine ... I am pushing package with module

ghost commented 7 years ago

I am sort of done with wasting my time trying to following to 2000 battles being fought in JavaScript-land. I have been stuck in that hell for too many years, and am tired by what an enormous mess web development has become. I just want to build applications, and the non-stop self-interest and egos involved at the standards, browser, tooling and infrastructure levels are making just building web applications a nightmare. The technical debt being imposed on application developers by keeping everything underneath in constant flux is out of control. Sorry to vent, not your fault, but nobody wants it is a pretty sweeping statement. File extensions have been used in web development to identify alternative file formats, so there doesn't seem to be anything unreasonable in introducing a new extension (not that I really care). I just want things to work.

WebReflection commented 7 years ago

whenever you'll find time to read my blog post you'll understand why .mjs isn't solving anything in the real world and it makes everything more messy/ambiguous instead.

A good goal with bananas as result.

You have that "module" thing in 1.12.2 now, I hope it works