Jump to content

Подключение babel к vuejs и webpack


Recommended Posts

Надо подцепить babel к webpack и vuejs? Сейчас покажу как: 

  1. В файл package.json, в секцию devDependencies добавляем:
    "@babel/core": "^7.11.6",
    "@babel/plugin-transform-runtime": "^7.11.5",
    "@babel/preset-env": "^7.11.5",
    "babel-loader": "^8.1.0",
    image.png.ae5aa4910076a5783404ecc92345af89.png
  2. Создаём файл: .babelrc в корне. В нём прописываем:
    {
      "presets": ["@babel/preset-env"],
      "plugins": [
        ["@babel/transform-runtime"]
      ]
    }
  3. Переходим в webpack.config.js  и добавляем в раздел module.rules:
    {
        test: /\.js$/,
        use: {
            loader: "babel-loader"
        }
    },
    image.png.1b4a9c41dd4ee104f8a6161f67f5fac5.png

  

 

Запускаем. Должно запуститься как надо.

 

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...