What is the main file that vue-cli-service utilizes for entry?

Interested in a project utilizing vue, webpack, babel, npm?
You can launch it with npm run server. While exploring how this command functions, I came across vue-cli-service serve in the package.json file.

But how exactly does vue-cli-service initialize the program? I noticed that there is a main.js file that renders Vue.vue, both located within the src/ directory.

I couldn't find any configuration for the entry file. Does this mean that main.js serves as the default entry point for vue-cli-service?


Code

package.json:

{
  "name": "quizer-ui",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve --port 3000",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^2.6.5",
    "element-ui": "^2.10.1",
    "vue": "^2.6.10",
    "vue-router": "^3.0.7"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "^3.9.0",
    "@vue/cli-plugin-eslint": "^3.9.0",
    "@vue/cli-service": "^3.9.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "vue-cli-plugin-element": "^1.0.1",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}

Answer №1

vue-cli-service utilizes Webpack with a default configuration starting at './src/main.js'.

entry: {
  app: [
    './src/main.js'
  ]
}

If you desire, this configuration can be customized in vue.config.js. More information can be found at https://cli.vuejs.org/guide/webpack.html#simple-configuration.

Webpack will create a JS bundle beginning at the entry point, then inject it into the index.html file to initialize your application.

To view the full configuration of your app, use:

vue inspect

For details, visit https://cli.vuejs.org/guide/webpack.html#inspecting-the-project-s-webpack-config

Answer №2

It is built into the framework @vue.

Location:

node_modules/@vue/cli-service/lib/config/base.js

Lines 28-37:

    webpackConfig
      .mode('development')
      .context(api.service.context)
      .entry('app')
        .add('./src/main.js')
        .end()
      .output
        .path(api.resolve(options.outputDir))
        .filename(isLegacyBundle ? '[name]-legacy.js' : '[name].js')
        .publicPath(options.publicPath)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is preventing the random images from appearing on my browser?

Having some trouble loading random images on a page using basic JavaScript code. Following homework instructions, but the images are not showing up in the web browser. Any assistance would be greatly appreciated. Here is the code: <?xml version="1.0" ...

The toggle class feature of jQuery is malfunctioning when placed inside a different div

Hello everyone, I am currently working on a toggle effect on my webpage. However, I encountered an error when trying to move the button close to another part of the page. The button works fine if it is placed in one part of the HTML, but does not work if i ...

Refresh page to reload JSON file with jQuery

My current objective is the following: $.getJSON(sampleJson.json), function(data) {} I aim to read data from sampleJson.json and display it on a webpage. The displayed data can be altered through an AJAX call like so: $.ajax({type: "GET", url: "...", da ...

Can you explain the significance of network activity groupings within the Firebug Net tab?

Can you explain the significance of different splitter lines on the Net tab in Firebug? In this screenshot, line 1 and 2 appear to be grouped together. However, line 3 stands alone. What do these groupings represent? ...

Passing role data from Django Rest Framework and Djoser to the Vue frontend

I'm currently developing a basic website with a login feature. I am utilizing the Djoser library to handle authentication on the backend, and have successfully implemented the login functionality. Now, I want to create restricted access pages on the f ...

Utilizing Angular's ng-Grid with Promises

My current setup involves fetching a JSON file through a service to serve as the data source for my grid. The service successfully fetches the data, and the grid renders its basic layout correctly. However, there seems to be an issue with populating the gr ...

Using Typescript with Angular 2 to Implement Google Sign-In on Websites

Currently, I am in the process of creating a website that utilizes a typical RESTful web service to manage persistence and intricate business logic. To consume this service, I am using Angular 2 with components coded in TypeScript. Instead of developing m ...

Mongoose schema nesting guide

I've encountered an issue while attempting to nest schemas in mongoose, and unfortunately I'm struggling to pinpoint the exact cause. Here's what my current setup looks like. Starting with the parent schema: const Comment = require("./Comm ...

Employing both Angular 1 and Angular 2 in conjunction

As a newcomer to angular, this is my first experience. My ultimate goal is to incorporate the following component into Angular 2: While I have some knowledge of JavaScript, I am attempting to integrate an Angular 1 library into an Angular 2 project. Aft ...

Converting MultiSelect Array from JavaScript to MySQL

I recently implemented a multiselect feature on the client side: <select name="country" data-placeholder="Choose a Country..." tabindex="2"> <option name="country" value="United States">United States</option> & ...

Setting background colors for classes based on an array

I have a total of six div elements on a single page, all sharing the same class. My goal is to give each one a unique color from an array I have prepared. I want to avoid any repetition of colors among these divs. Currently, I have managed to assign backg ...

Having trouble with test coverage in Mocha using Blanket?

I have a Node application that I want to test and generate a coverage report for. I followed the steps outlined in the Getting Started Guide, but unfortunately, it doesn't seem to be working correctly. In my source code file named src/two.js: var tw ...

How to easily retrieve additional data and update a document using Meteor

I'm feeling a bit lost on the best approach for obtaining additional data, particularly using an API, and adding it to the existing list. Imagine we're implementing either an infinite scroll or a 'load more' button, when that action oc ...

Tips on maintaining the Parent menu in a hovered state when the mouse is over the child menu within a Dropdown Menu

I have been working on creating a dropdown menu that functions correctly. However, I am facing an issue where the top menu, when hovered, turns white, but as soon as I move down to the submenus, the top menu reverts back to its original color. Is there a ...

How to retrieve the Vue instance within a Laravel Inertia component

I am facing a challenge in extracting data from a dynamic HTML containing interpolation within a Vue component using Inertia. Here is a snippet of my code: <template> <div v-if="parsed" v-html="parsed"></div> </t ...

How can I retrieve all element attributes in TypeScript using Protractor?

I came across this solution for fetching all attributes using protractor: Get all element attributes using protractor However, I am working with TypeScript and Angular 6 and struggling to implement the above method. This is what I have tried so far: im ...

The FlatList glides effortlessly in any direction

My FlatList allows me to drag and move it in all directions (up/down/right/left) even though it appears vertically due to styling. The scroll bar still shows horizontally, which I want to disable. How can I achieve this? This is the code snippet for using ...

ReactJS: Dealing with issues in setting a dynamic index for the setState key

I have been attempting to utilize setState within a for loop using index in the following manner: for (var i = 0; i <= 9; i++) { this.setState({ location_option[i]: resourceData.location_option+i, location_option[i]_type: resourceData.locatio ...

Integration Between AppEngine and GitHub

Seeking assistance - encountering an issue with my Github account. It appears to be flagged and the files are not updating following commits. The trigger seems to be working correctly, but the actual files remain outdated. How can this problem be resolve ...

Issue with specific route causing server to throw 500 error

Recently, I have been working on a small school project that involves creating our own API and connecting it to an Angular front end. While following some tutorials, I encountered an issue where my application started throwing internal server error 500 af ...