Using Deno to Compile TypeScript to JavaScript
Asked Answered
R

2

6

I'm working on some Deno projects and would like to be able to compile TypeScript to JavaScript to run in the browser (since TS is not yet supported). When I worked with NodeJS I installed the tsc compiler using npm but it seems overkill to install a second JavaScript runtime (NodeJS) just to get access to tsc. Does Deno have a compiler built-in?

I'm running Ubuntu server.

Ruhr answered 5/2, 2021 at 17:1 Comment(2)
Installation doc here: typescriptlang.org/downloadProstration
Thanks for the quick response however the link you posted suggests installing via npm which is what I'm trying to avoid.Ruhr
K
4

There is built in bundler, so you don't need separate tool.

Kerriekerrigan answered 5/2, 2021 at 17:48 Comment(1)
CAUTION: deno bundle has been deprecated and will be removed in some future release.Hickman
D
5

Sadly, As of Deno 1.31, the built-in bundler is now deprecated.

However the built-in bundler was never really made to do web bundling, its just designed to bundle all the code into one file.

If that is all you want (one big JS file) I've created a deno package that tries to stay true to the original deno bundle:
https://github.com/jeff-hykin/deno_bundle. It uses the official deno plugin for ES build under the hood. It supports node builtin imports but will never support npm imports.

If you specifically want to bundle for the web, I'd recommended Vite with the deno plugin or some other dedicated bundling tool

Dermott answered 17/7, 2023 at 22:24 Comment(0)
K
4

There is built in bundler, so you don't need separate tool.

Kerriekerrigan answered 5/2, 2021 at 17:48 Comment(1)
CAUTION: deno bundle has been deprecated and will be removed in some future release.Hickman

© 2022 - 2024 — McMap. All rights reserved.