←back to thread

277 points merqurio | 3 comments | | HN request time: 0.008s | source
Show context
TekMol ◴[] No.45114230[source]
I'm all for a lightweight approach to software development. But I don't understand the concept here.

Looking at the first example:

First I had to switch it from TS to JS. As I don't consider something that needs compilation before it runs to be lightweight.

Then, the first line is:

    import {html, css, LitElement} from 'lit';
What is this? This is not a valid import. At least not in the browser. Is the example something that you have to compile on the server to make it run in the browser?

And when I use the "download" button on the playground version of the first example, I get a "package.json" which defines dependencies. That is also certainly not something a browser can handle.

So do I assume correctly that I need to set up a webserver, a dependency manager, and a serverside runtime to use these "light weight" components?

Or am I missing something? What would be the minimal amount of steps to save the example and actually have it run in the browser?

replies(3): >>45114259 #>>45114323 #>>45127361 #
fmbb ◴[] No.45114259[source]
The browser supports module imports. But your script must be of type ”module”: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
replies(1): >>45114275 #
1. TekMol ◴[] No.45114275[source]
Not with paths like 'lit' that is used here.
replies(1): >>45114279 #
2. uallo ◴[] No.45114279[source]
Import map:

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

replies(1): >>45114287 #
3. TekMol ◴[] No.45114287[source]
The example does not use an importmap attribute.

Overall, the example does not seem like something that is supposed to run directly in the browser without some kind of intermediate step.

That is why I asked what the minimal number of steps would be to download the example and have it work locally.