Friday 19 January 2024

How do you use various CDNs in Vuejs explain with example?094

 How do you use various CDNs in Vuejs explain with example?

Here's how to use various CDNs to include Vue.js in your web projects:

1. Unpkg CDN:

  • Latest version:
    <script src=""></script>

  • Specific version (e.g., v3.2.41):
    <script src=""></script>

2. jsDelivr CDN:

  • Latest version:
    <script src=""></script>

  • Specific version:
    <script src=""></script>

3. Google Hosted Libraries:

  • Vue 2 (no longer updated):
    <script src=""></script>

4. Custom CDN:

  • If you have a custom CDN, use the appropriate URL to reference Vue.js.

Key Points:

  • Direct Inclusion: CDN links allow direct inclusion of Vue.js in HTML without build tools.

  • Development and Prototyping: Ideal for quick experimentation and simple projects.

  • No Build Process: Eliminates setup and configuration, making it faster to get started.

  • Potential Limitations:

  • May not be suitable for production due to caching issues and lack of control over versions.

  • Cannot use Single-File Components (SFCs) directly from CDNs.

Example Usage:


<!DOCTYPE html>
  <title>Vue CDN Example</title>
  <script src=""></script>
  <div id="app">
    <p>{{ message }}</p>
    const app = Vue.createApp({
      data() {
        return {
          message: 'Hello, Vue from CDN!'


  • For production environments and more complex projects, consider using a build tool like Vue CLI for better control and optimization.

  • Keep CDN links up-to-date for security and compatibility.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.