Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Deno Web Development

You're reading from   Deno Web Development Write, test, maintain, and deploy JavaScript and TypeScript web applications using Deno

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781800205666
Length 310 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Alexandre Santos Alexandre Santos
Author Profile Icon Alexandre Santos
Alexandre Santos
Alexandre Portela dos Santos Alexandre Portela dos Santos
Author Profile Icon Alexandre Portela dos Santos
Alexandre Portela dos Santos
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Section 1: Getting Familiar with Deno
2. Chapter 1: What is Deno? FREE CHAPTER 3. Chapter 2: The Toolchain 4. Chapter 3: The Runtime and Standard Library 5. Section 2: Building an Application
6. Chapter 4: Building a Web Application 7. Chapter 5: Adding Users and Migrating to Oak 8. Chapter 6: Adding Authentication and Connecting to the Database 9. Chapter 7: HTTPS, Extracting Configuration, and Deno in the Browser 10. Section 3: Testing and Deploying
11. Chapter 8: Testing – Unit and Integration 12. Chapter 9: Deploying a Deno Application 13. Chapter 10: What's Next? 14. Other Books You May Enjoy

Bundling code

In the previous chapter, when we presented Deno, we elected bundling code as an exciting feature for many reasons. This feature has enormous potential, and we will explore this in more detail in Chapter 7, HTTPS, Extracting Configuration, and Deno in the Browser. But since we're exploring the CLI here, we'll get to know the appropriate command.

It is called bundle, and it bundles code into a single, self-contained ES module.

Bundled code that doesn't depend on the Deno namespace can also run in the browser with <script type="module"> and in Node.js.

Let's use it to build our get-current-time.js script:

$ deno bundle get-current-time.js bundle.js
Bundle file:///Users/alexandre/dev/deno-web-development/Chapter02/2-hello-world/get-current-time.js
Emit "bundle.js" (2.33 KB)

Now, we can run the generated bundle.js:

$ deno run bundle.js
0:11:4

This will print the current time.

We can also execute it with...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime