Skip to content
Search

Vue:ProjectTemplate:Vue2 Babel

lastmod 2020-09-28created 2020-09-284 edits

A template for installing vue2+babel with vue-cli.

Command

$ vue create .
Vue CLI v4.5.6
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel
? Choose a version of Vue.js that you want to start the project with 2.x
? Where do you prefer placing config for Babel, ESLint, etc.? In package.json
? Save this as a preset for future projects? No

package.json file

{
  "name": "t2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "vue": "^2.6.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "vue-template-compiler": "^2.6.11"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

Compared with a project with Only vue2 installed, the following were added.

  • dependencies: core-js
  • devDependencies: @vue/cli-plugin-babel

babel.config.js file

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ]
}

ETC files

The remaining files and their contents are the same as in the Only vue2 template page.

See also

author Zer0 sitemap