Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-on Nuxt.js Web Development

You're reading from   Hands-on Nuxt.js Web Development Build universal and static-generated Vue.js applications using Nuxt.js

Arrow left icon
Product type Paperback
Published in Aug 2020
Publisher Packt
ISBN-13 9781789952698
Length 698 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Lau Tiam Kok Kok Lau Lau Tiam Kok Kok Lau
Author Profile Icon Lau Tiam Kok Kok Lau
Lau Tiam Kok Kok Lau
LAU THIAM KOK LAU THIAM KOK
Author Profile Icon LAU THIAM KOK
LAU THIAM KOK
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Preface 1. Section 1: Your First Nuxt App
2. Introducing Nuxt FREE CHAPTER 3. Getting Started with Nuxt 4. Adding UI Frameworks 5. Section 2: View, Routing, Components, Plugins, and Modules
6. Adding Views, Routes, and Transitions 7. Adding Vue Components 8. Writing Plugins and Modules 9. Adding Vue Forms 10. Section 3: Server-Side Development and Data Management
11. Adding a Server-Side Framework 12. Adding a Server-Side Database 13. Adding a Vuex Store 14. Section 4: Middleware and Security
15. Writing Route Middlewares and Server Middlewares 16. Creating User Logins and API Authentication 17. Section 5: Testing and Deployment
18. Writing End-to-End Tests 19. Using Linters, Formatters, and Deployment Commands 20. Section 6: The Further Fields
21. Creating an SPA with Nuxt 22. Creating a Framework-Agnostic PHP API for Nuxt 23. Creating a Real-Time App with Nuxt 24. Creating a Nuxt App with a CMS and GraphQL 25. Other Books You May Enjoy

Bundling and splitting code with webpack

Nuxt uses webpack to bundle, minify, and split your code into chunks that can speed up the load time of your app. For example, in a simple Nuxt app with two pages, index/home and about, you will get similar chunks for the client-side:

Hash: 0e9b10c17829e996ef30 
Version: webpack 4.43.0
Time: 4913ms
Built at: 06/07/2020 21:02:26
Asset Size Chunks Chunk Names
../server/client.manifest.json 7.77 KiB [emitted]
LICENSES 389 bytes [emitted]
app.3d81a84.js 51.2 KiB 0 [emitted] [immutable] app
commons/app.9498a8c.js 155 KiB 1 [emitted] [immutable] commons/app
commons/pages/index.8dfce35.js 13.3 KiB 2 [emitted] [immutable] commons/pages/index
pages/about.c6ca234.js 357 bytes 3 [emitted] [immutable] pages/about
pages/index.f83939d.js 1.21 KiB 4 [emitted] [immutable] pages/index
runtime.3d677ca.js 2.38 KiB 5 [emitted] [immutable] runtime
+ 2 hidden assets
Entrypoint app = runtime.3d677ca.js commons/app.9498a8c.js app.3d81a84.js

The chunks that you would get for the server-side will look as follows:

Hash: 8af8db87175486cd8e06 
Version: webpack 4.43.0
Time: 525ms
Built at: 06/07/2020 21:02:27
Asset Size Chunks Chunk Names
pages/about.js 1.23 KiB 1 [emitted] pages/about
pages/index.js 6.06 KiB 2 [emitted] pages/index
server.js 80.9 KiB 0 [emitted] app
server.manifest.json 291 bytes [emitted]
+ 3 hidden assets
Entrypoint app = server.js server.js.map

These chunks and the build information are generated when you use Nuxt npm run build command to build your app for deployment. We will look at this in more detail in Chapter 14, Using Linters, Formatters, and Deployment Commands.

This aside, there are other great features and plugins from webpack that are used by Nuxt, such as static files and asset serving (asset management), hot module replacement, CSS extraction (extract-css-chunks-webpack-plugin), a progress bar while you're building and watching (webpackbar), and so on. For more information, please visit the following links:

These great features from webpack, Babel, and Nuxt itself will make your modern project development fun and easy. Now, let's take a look at the various application types to see why you should or shouldn't use Nuxt when you're building your next web app.

You have been reading a chapter from
Hands-on Nuxt.js Web Development
Published in: Aug 2020
Publisher: Packt
ISBN-13: 9781789952698
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 $15.99/month. Cancel anytime
Visually different images