Couldn't find preset "es2015" relative to directory

Posted lude1994

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Couldn't find preset "es2015" relative to directory相关的知识,希望对你有一定的参考价值。

在引入element-ui引发的问题,解决如下:

  1.npm install babel-preset-es2015 --save-dev

  2.修改.babelrc 

    

{
  "presets": [
    ["es2015", { "modules": false }],
    ["env", {
      "modules": false,
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2"
  ],
  "plugins": [
    "transform-vue-jsx",
    "transform-runtime",
    [
      "component",
      {
        "libraryName": "element-ui",
        "styleLibraryName": "theme-chalk"
      }
    ]
  ],
  "env": {
    "test": {
      "presets": ["env", "stage-2"]
    }
  }
}

  3.在webpack.base.conf.js文件中加入如下代码:

  

loaders: [
      {
        test: /.js$/,
        exclude: /(node_modules|bower_components)/,
        loader: babel,
        query: {
          presets: [es2015]
        }
      }
    ]

技术图片

 

 

以上是关于Couldn't find preset "es2015" relative to directory的主要内容,如果未能解决你的问题,请参考以下文章

Scaling dynos... ! ! Couldn't find that process type (web).

U盘启动盘安装win10出现cdboot:couldn't find ntldr

linux g++安装 E: Couldn't find package g

Win10自带虚拟机上安装XP系统时CDBOOT: Couldn't find BOOTMGR?

Python-使用unrar库时Couldn't find path to unrar library的解决办法

Python-使用unrar库时Couldn't find path to unrar library的解决办法