Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add vue-cli to the existing project?

Tags:

I have a project on Vue.js using Webpack. And I want to add vue-cli features to it so I can work with it like I do with vue-cli generate project. But I don't know how to integrate vue-cli with existing project.

With new project I can do vue create <project-name but I couldn't find the instruction on integrating it with existing projects. Is there an official way to do so? (I suppose I can just create the new project and move all of the sources there, but still probably there's a better way to do it)

like image 238
serge1peshcoff Avatar asked Apr 11 '19 13:04

serge1peshcoff


People also ask

How do you check vue cli is installed or not?

You can verify that it is properly installed by simply running vue , which should present you with a help message listing all available commands.

How do I update my vue project?

@OrestesKappa Just install vue at the version you want or just use npm install vue@latest --save to get the latest (note that updating from 2 to 3 requires quite some changes and many extensions haven't been updated yet).

How do I install and use Vue CLI?

There are two ways that you can run and use Vue CLI 3.0: through a global installation or through npx. You will learn about both here. If you have previously installed vue - cli, v1. x or v2. x, you need to uninstall it first by running the following command: The Vue CLI package has been renamed for v3. x to @vue / cli.

How do I create a VUE project in Visual Studio?

The GUI will open in your browser. The Projects tab shows the existing Vue projects. The Create tab is the one we need. Clicking it, select the folder you want to create your project in and click to start creating a new project at that location. Give a name to the project folder, select the options you want and move on to the next step.

What is Vue CLI in vuejs?

The Vue CLI has evolved into a full system for rapid VueJS development. Vue CLI 3.0 comes packed with extraordinary tooling that increases developer experience by providing fast and intuitive project scaffolding, webpack sensible defaults, zero configuration, extensibility, and much more.

Should I install the Vue CLI locally or through NPX?

The Vue CLI is under active development and using it through npx is good for an one-off trial, but if you are a Vue developer dedicated to managing and creating many Vue projects with lots of dependencies, a global installation for local usage is a better approach to avoid bug or conflicts that may be introduced in future releases.


2 Answers

Inside the Project Folder in the terminal enter vue create .

like image 169
Sikiru Abidemi Tiamiyu Avatar answered Oct 04 '22 23:10

Sikiru Abidemi Tiamiyu


I did it the "painful" way - by creating a new project and comparing to my existing one. I say painful because I was using Bootstrap directly in index page, also PWA settings. Parcel was used as a packager and my folders were all in the root (assets, components, etc.).

However, it was not that bad. The things I did to make the transition easier:

  • adjusted the folder hierarchy and names to match the new project
  • added the missing plugins to package.json
  • removed all PWA settings from index.html. They get injected automatically.
  • added the missing files and folders from the new project, namely
    • /public with contents
    • all the individual config files in root
  • added .eslintignore, ignoring node_modules/**
  • renamed index.js to main.js (although probably not necessary)
  • added bootstrap css through import in main.js
  • adjusted image paths (favicon and others). The favicon paths and names can probably be customized
  • updated "serve" script to "vue-cli-service serve --host 127.0.0.1 --port 8080" in order to run the dev server
like image 21
Alen Siljak Avatar answered Oct 04 '22 22:10

Alen Siljak