0

I've just started to learn Vue and I wonder, how is it made? I see in the begining of main.js

import Vue from 'vue'
import App from './App.vue'

and the content of App.vue is not Javascript at all. How is it made to be understandable by Javascript?

3
  • As I know, it is called Parsing in JavaScript. With packages such as: babel, eslint, ... it can read files and parsed to correct data Commented Oct 30, 2021 at 12:15
  • 2
    Webpack uses vue-loader(vue-loader.vuejs.org) to load vue files. Commented Oct 30, 2021 at 12:22
  • 3
    Javascript doesn't understand Vue. Vue gets compiled to Javascript code with a module bundler (usually Webpack or Vite). Commented Oct 30, 2021 at 13:09

1 Answer 1

2

When using .vue files in a Vue application, it is necessary to use the vue-loader dependency. This library is a loader for webpack that allows you to create Vue components in a Single-File Components format.

Documentation:

There are many cool features provided by vue-loader:

  • Allows using other webpack loaders for each part of a Vue component, for example Sass for and Pug for .
  • Allows custom blocks in a .vue file that can have custom loader chains applied to them.
  • Treat static assets referenced in and as module dependencies and handle them with webpack loaders.
  • Simulate scoped CSS for each component.
  • State-preserving hot-reloading during development.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.