zoukankan      html  css  js  c++  java
  • Vue .babelrc配置

    在VUE开发过程中。需要使用babel来讲ES6及其以上的语法转化成可以被是识别的语法。因此需要使用:babel-loader.

    babel-loader7.x 需要使用的插件 以及.babelrc 文件中的内容

    npm i -D babel-core babel-loader babel-plugin-transform-runtime
    npm i -D babel-preset-env babel-preset-stage-0
    {
      "presets": ["env", "stage-0"],
      "plugins": [
        "transform-runtime"
      ]
    }

    babel-loader8.x 需要使用的插件。以及.bablerc文件中的内容

    npm i @babel/core babel-loader @babel/plugin-transform-runtime @babel/plugin-proposal-object-rest-spread -D
    npm i @babel/preset-react @babel/preset-env babel-preset-mobx -D
    npm i @babel/runtime -S
    {
      "presets": ["@babel/preset-react", "@babel/preset-env", "babel-preset-mobx"],
      "plugins": [
        "@babel/plugin-transform-runtime",
        "@babel/plugin-proposal-object-rest-spread",
        "transform-remove-strict-mode" // 去除严格约束时使用
      ]
    }
    // babelrc为json文件不可以有注

    报错:

    "use strict" 使用插件 babel-plugin-transform-remove-strict-mode  之后在.babelrc中加上

    '@babel/core' 就是babel-loader和babel-core的版本不匹配。

  • 相关阅读:
    在 Cocos2d-x 中添加自己的微博链接
    关于屏幕适配
    [抽象工厂模式]在游戏开发中的应用
    字符串排列组合
    子矩阵最大和
    网易游戏编程题第二题
    动态规划,最大子段和
    C++的四种显示类型转换
    多线程编程
    预处理等等
  • 原文地址:https://www.cnblogs.com/jisa/p/11819023.html
Copyright © 2011-2022 走看看