码迷,mamicode.com
首页 > 其他好文 > 详细

Couldn't find preset "es2015" relative to directory

时间:2019-12-08 10:36:44      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:code   base   文件   pac   lse   引入   install   tran   node   

在引入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

标签:code   base   文件   pac   lse   引入   install   tran   node   

原文地址:https://www.cnblogs.com/lude1994/p/12004642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!