最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - Using Deno to Compile TypeScript to JavaScript - Stack Overflow

programmeradmin3浏览0评论

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

I'm running Ubuntu server.

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

I'm running Ubuntu server.

Share Improve this question asked Feb 5, 2021 at 17:01 Mark TyersMark Tyers 3,2494 gold badges34 silver badges58 bronze badges 2
  • Installation doc here: typescriptlang/download – Jonas 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. – Mark Tyers Commented Feb 5, 2021 at 17:09
Add a ment  | 

3 Answers 3

Reset to default 9

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

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

You can now use deno pile to pile 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-piling to different target architectures is supported using the --target flag.

发布评论

评论列表(0)

  1. 暂无评论