WebReflection / hyperHTML

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

Can we use hyperhtml without bundler or any other tooling #388

Closed fernandocanizo closed 4 years ago

fernandocanizo commented 4 years ago

Context: I've been trying hyperHTML so far by using the CDN import, however today I found a "Too many request" error after an attempt to reload the page I was working on, so I decided to give a second try to the npm install hyperhtml technique. The first time I tried it gave me problems too, but I was too eager to try the library I didn't care and just went for the thing that worked.

So, so far I've been using:

Uncaught TypeError: Failed to resolve module specifier "hyperhtml". Relative references must start with either "/", "./", or "../".

Of course, I'm serving app/front/ as root path so node_modules, which exists at app/ level, it's unseen

That last error made me suspect maybe I'm trying to achieve something hyperHTML is not designed for: to use it without any tooling at all.

I've been reading docs and related issues, in particular #75 which is the most related one, but it seems the tooling is implied in all solutions provided either on the docs, since all examples don't put a path in the import and it seems a required thing if one is using imports without bundler.

WebReflection commented 4 years ago

Closing as this has nothing to do with hyperHTML, you need a bundler or simply use the CDN version without passing ?module to the URL, it's already pre bundled for you 👋

WebReflection commented 4 years ago

Apologies for my previous quick answers from my mobile, the thing is that you can simply

<script src="https://unpkg.com/hyperhtml"></script>

on top of your page, to have a global hyperHTML instance to use, or you need a bundler, such as rollup, webpack, or you name it, like it is for the entirety of the libraries published in npm to date, unless these have zero dependencies, which is not the case for hyperHTML, and likely never will.

fernandocanizo commented 4 years ago

Apology accepted :) Anyway I'll reply your question: Do I know how to use modules? I'm realizing not quite right. So, I offer my apologies for making issues of naive questions. Maybe this was a good case for a Stack Overflow question? (Instead of an issue). However I feel issues are more response time streamlined.

To offer more context: I was trying to build a thing without a bundler. I'm trying to escape the tool-izization of the web development: transpilation, minification, uglyfication and bundling. Now I see it's not possible to escape everything.

WebReflection commented 4 years ago

@fernandocanizo I use import {bind, wire} from https://unpkg.com/hyperhtml?module all the time, that doesn't require any tool, but it also doesn't work offline, 'cause if you need that, it means you need a bundler.

the ECMAScript module world is still floating between Web and NodeJS, and while it's getting there, it's not 100% there yet, and it'll take another year, imho, but meanwhile everyone else used bundlers, for both NodeJS or Web whatsoever, and these all work great 👋