vue-loader (original) (raw)

17.3.1 • Public • Published 2 years ago

vue-loader ci

webpack loader for Vue Single-File Components

v17.2.1+ Only Options

v16+ Only Options

What is Vue Loader?

vue-loader is a loader for webpack that allows you to author Vue components in a format called Single-File Components (SFCs):

{{ msg }}

There are many cool features provided by vue-loader:

In a nutshell, the combination of webpack and vue-loader gives you a modern, flexible and extremely powerful front-end workflow for authoring Vue.js applications.

How It Works

The following section is for maintainers and contributors who are interested in the internal implementation details of vue-loader, and is not required knowledge for end users.

vue-loader is not a simple source transform loader. It handles each language blocks inside an SFC with its own dedicated loader chain (you can think of each block as a "virtual module"), and finally assembles the blocks together into the final module. Here's a brief overview of how the whole thing works:

  1. vue-loader parses the SFC source code into an SFC Descriptor using @vue/compiler-sfc. It then generates an import for each language block so the actual returned module code looks like this:
    // code returned from the main loader for 'source.vue'
    // import the block
    import render from 'source.vue?vue&type=template'
    // import the