Live data from Hacker News

You don't need a build step

deno.com

31–40 of 224 posts

Re: You don't need a build step

#31
I thought this will be an article about adding import maps to deno, which would be great.

I hope builders start adding it (at least to dev instances) to decrease the magic.

I was trying to use import maps, but it's not trivial go create actually.

There are always problems with Node lagging behind browsers though that makes developing hard (no WebSocket support by default for example, crypto module is also not included)

Re: You don't need a build step

#32

So basically Deno has its own bundler that lets you not have a local build step and it gets bundled dynamically per-route as requested by users, right? This is very different from industry standards and possibly has many new concerns from devs, none of which are addressed in the article since it's treating the system as a perfect solution, which makes sense since it's a marketing page ("content marketing"). If it was…

[deleted]

Re: You don't need a build step

#34
post #4

I tend to stick with script tags as much as I can. Really the problem are all the frameworks pushing people to create a build step. Their excuse is optimising the code size, but for most cases that matters little, I don't mind including all of tailwind or font-awesome. So please, if you own a framework like this, make sure a script tag with a CDN link is easily copyable.

The reason for bundling is converting potentially hundreds of individual script files to an amount that’s more manageable with a browser, without suffering a cost from latency… not only optimizing code size. Also, besides tree-shaking there’s a big saving from minimization and removing development-only code.

With HTTP/2 multiplexing the latency of fetching multiple files from the same server is not a big issue anymore: https://stackoverflow.com/a/30864259.

One can also argue that Minification is also not really that important with widespread new compression algorithms like Brotli.

EDIT: Also, see this very good argument in favor of multiple files: https://news.ycombinator.com/item?id=34997759

Re: You don't need a build step

#35

I thought this will be an article about adding import maps to deno, which would be great. I hope builders start adding it (at least to dev instances) to decrease the magic. I was trying to use import maps, but it's not trivial go create actually. There are always problems with Node lagging behind browsers though that makes developing hard (no WebSocket support by default for example, crypto module is also not include…

Deno does support import maps out of the box. For Node there’s a loader[1] you can use (though a glance at the GitHub issues suggests it’s incomplete).

1: https://www.npmjs.com/package/@node-loader/import-maps

Re: You don't need a build step

#36
post #33

So, if I'm using URLs for dependencies, effectively I can't code while I'm offline? I know it's not the norm, but there have been plenty of times I needed to work without internet.

I’m fairly certain Deno caches the downloaded artifacts locally. There’s also tooling for downloading all dependencies:

https://deno.land/manual@v1.29.1/tools/vendor

Re: You don't need a build step

#37
post #33

So, if I'm using URLs for dependencies, effectively I can't code while I'm offline? I know it's not the norm, but there have been plenty of times I needed to work without internet.

No. Deno supports vendoring, caching and locking of dependencies just like other ecosystem.

They are not fetched every time you run the app.

Re: You don't need a build step

#38
post #8

Earlier quoted context omitted.

"Build" in JS circles usually means transpile, not a replacement for JIT which will still happen at runtime. In addition to that, often there are other concerns addressed at build time such as linting.

yeah, exactly. So I wonder if ultimately they want to have the browser handle transpiling things like typescript? And I definitely think there are other concerns (such as linting) that you want to happen as part of your development pipeline.

There is an ES39 proposal to allow type annotations in Javascript, that would allow the browser to handle TS/Flow files without needing a compile step:

https://github.com/tc39/proposal-type-annotations

(That's only to allow the type annotations to be there, not to have static checking in the browser)

IMO: I would love to see this implemented. Linting and typechecking should be ran before committing code or deploying, but I want to be able to stop transpiling/bundling in all cases.

Re: You don't need a build step

#39

So Deno is relying on native ESM imports in production code? Isn't that exactly what Vite _doesn't_ do, because of poor performance? When you run the vite dev server it uses ESM, but when you build it uses rollup, because serving ESM is slow and with larger apps the client browser is going to make a bazillion requests. Wouldn't you rather traverse the dependency graph one time and bundle your code into modules so tha…

HTTP/2, which is getting pretty widespread now, mitigates most of the concerns about making a bazillion requests.
Post reply on HN