ElementUI / babel-plugin-component

Modular element-ui build plugin for babel.
452 stars 96 forks source link

presets {modules:false} 是否必选? #8

Closed callmez closed 7 years ago

callmez commented 7 years ago

加上这个选项后和vue-cli的骨架设置冲突,去掉的话 在使用element-ui或mint-ui有无影响?

QingWei-Li commented 7 years ago

理论上不会有问题,有遇到啥 bug 么

callmez commented 7 years ago

加上 {modules:false}后会报错.

Module build failed: ReferenceError: [BABEL] /resources/src/main.js: Using removed Babel 5 option: foreign.modules - Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules

.babelrc

{
  "presets": ["es2015", "stage-2", {modules: false}],
  "plugins": ["transform-runtime", ["component", [
    {
      "libraryName": "element-ui",
      "styleLibraryName": "theme-default"
    },
    {
      "libraryName": "mint-ui",
      "style": true
    }
  ]]],
  "comments": false,
  "env": {
    "test": {
      "plugins": [ "istanbul" ]
    }
  }
}

是不是我设置有问题?

这个设置麻烦请在文档里说明下使用原因.感谢!

QingWei-Li commented 7 years ago

你自己的 babel 配置错了。 modules 是 es2015 的选项。请自己看 babel 的文档。

callmez commented 7 years ago

"stage-2"的设置? 去掉了还是报错. 文档也看了, 烦请指教谢谢.

QingWei-Li commented 7 years ago

https://babeljs.io/docs/plugins/preset-es2015/#options

callmez commented 7 years ago

就是这样配置的

{
  "presets": ["es2015", {"modules": false}],
  "plugins": ["transform-runtime", ["component", [
    {
      "libraryName": "element-ui",
      "styleLibraryName": "theme-default"
    },
    {
      "libraryName": "mint-ui",
      "style": true
    }
  ]]],
  "comments": false,
  "env": {
    "test": {
      "plugins": [ "istanbul" ]
    }
  }
}

还是一样的错误

QingWei-Li commented 7 years ago

麻烦仔细看文档,选项都写错地方了

callmez commented 7 years ago

看到了谢谢.....