9

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.

2
  • Installation doc here: typescriptlang.org/download Commented Feb 5, 2021 at 17:04
  • Thanks for the quick response however the link you posted suggests installing via npm which is what I'm trying to avoid. Commented Feb 5, 2021 at 17:09

3 Answers 3

10

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

Update: As of Deno 2.4 (June 2025) the bundler was reinstated! And has some support for the web. Its not exactly what you're looking for, but it will convert a typescript file into a JS file, and you can add the --watch argument to have it continually convert.


Old Answer:

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 (deno install -g npm:vite) with the deno plugin or some other dedicated bundling tool

Sign up to request clarification or add additional context in comments.

Comments

4

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

1 Comment

CAUTION: deno bundle has been deprecated and will be removed in some future release.
2

You can now use deno compile to compile your source code –with TypeScript support out of the box– to standalone executables.

This allows distribution of a Deno application to systems that do not have Deno installed. Under the hood, it bundles a slimmed down version of the Deno runtime along with your JavaScript or TypeScript code.

Cross-compiling to different target architectures is supported using the --target flag.

2 Comments

The question is about bundling for the web as a javascript file, not making a binary executable.
You're totally right!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.