8 ms·
In 2021, I think it's safe to start a TypeScript project with Deno.
by mark_and_sweep 5y ago
In 2021, I think it's safe to start a TypeScript project with Deno.
- christiansakai 5y agoDoes Deno work for frontend?
- halfmatthalfcat 5y agoNo it's a replacement for Node.
- andrew_ 5y agoPlease stop spreading this misnomer. It's an alternative platform. It's absolutely not a wholesale replacement, and its inner workings are vastly different to Node. Edit: Well, someone touched a nerve! Doubt me, downvoters? You need but google to find a wealth of information to support the statement. https://www.imaginarycloud.com/blog/deno-vs-node/ https://www.imaginarycloud.com/blog/deno-vs-node/ is the first result, and there are a litany of other articles explaining the same.
- wa1987 5y ago> Please stop spreading this misnomer. That's a fairly… direct way of putting it :-) Anyway: 1. What are the key differences in terms of usage and use cases? 2. Why isn't Deno a 'wholesale' replacement for Node? 3. In which respect are the vastly differently inner workings relevant in regards to usage of both products?
- andrew_ 5y agoI suspect the reply was snide, masked by a smiley face, but here ya go anyhow. First result on Google for "deno vs node" https://www.imaginarycloud.com/blog/deno-vs-node/#:~:text=What%20is%20Deno%3F,implementation%20is%20in%20C%2B%2B https://www.imaginarycloud.com/blog/deno-vs-node/#:~:text=Wh...) that covers the basics of all three asked points.
- mannanj 5y agoI did not want to have to sift through a hefty article to get answers to the questions. Anyone can google search, but I see the points of the comments to share condensed information not just to "link" to google. Here's what I discovered as what I presume andrew_'s reasoning for why its not a node replacement (from the article) "Node has been under development for over a decade, which makes it more stable and battle-tested, making it the de facto standard for server-side JavaScript. Deno has only been under development for just two years and continues to be improved. Among other things, Deno is an excellent replacement for utility scripts that are usually written with bash or python."
- r0p3 5y agoThis article gives the distinct impression that Deno is an alternative to node and solves the same problems.
- TechBro8615 5y agoDeno as a "replacement for node" seems like a roughly accurate three word description. Neither Node nor Deno is a programming language. Both are runtimes, just like the browser. All three of them link with V8 which is the actual runtime (technically it's a JIT compiler, and only Chromium based browsers use V8 -- Firefox uses SpiderMonkey and Safari uses WebKit). So to answer the original question, "Does Deno work for frontend?", the premise of the question is inaccurate because Deno is an environment where you can run TypeScript code. It doesn't make sense to "run Deno in the frontend" (though maybe you could come up with some wasm monstrosity enabling an approximation of it). The better question would be, "can I share (as in re-use) TypeScript code in Deno and the Frontend?" to which the answer would be mostly yes -- but you'll still likely end up needing bundlers like webpack to help with it.
- KajMagnus 5y agoI have in mind to use Deno instead of both Node and Bash scripts :- )
- mark_and_sweep 5y agoAs always, depends on your use case. I'd say it has lower friction in general since Deno is using Web APIs, e.g. the fetch API is built-in (see https://deno.land/manual@v1.9.1/runtime/web_platform_apis https://deno.land/manual@v1.9.1/runtime/web_platform_apis).
- danieka 5y agoIt's possible, but slightly cumbersome, to write isomorphic apps. Deno has a library that can bundle Typescript for the browser at runtime. But maybe look into Vite instead for frontend.
- liminal 5y agoDoesn't that depend on what libraries you need?
- mark_and_sweep 5y agoAny JS that runs in the browser runs in Deno, too - so that's quite a few libraries... If there is a Node-specific library, i.e. a lib that uses the require global, the fs module, etc., then you can, in many cases, use the Node compat module from the Deno std lib and just drop it into your project. That being said, there's of course a Deno-specific ecosystem of libs, too, i.e. libs that use the Deno global. So you might find a suitable replacement if your favorite Node lib is not compatible for some reason.
- bfm 5y agoThis! After working with node.js for more than eight years I decided to give deno a try (https://github.com/bermi/genetic https://github.com/bermi/genetic) and I’ve been gratefully surprised by the development experience. I’m just missing a simple way to include deno code on my existing node.js and browser projects.
- chrisjc 5y agoDo you have any quickstart guides that you could recommend to get started with Typescript and Deno?
- flakiness 5y agoWhy not just following the official doc? https://deno.land/manual@v1.9.1/getting_started https://deno.land/manual@v1.9.1/getting_started One of good things about Deno is that it has golang-like opinionated/standardized workflow.
- lkesteloot 5y agoHas anyone experimented with making a custom version of Deno that has its TS files built-in? I want to give my user exactly one binary that they can run to use the tool I'm writing, as if I'd compiled it in C/go.
- skneko 5y agoCustom version? Isn't `deno compile` what you want?
- lkesteloot 5y agoWOW! Thank you!