ElementUI / babel-plugin-component

Modular element-ui build plugin for babel.
451 stars 95 forks source link

Fails to install with vue-cli 3.0 #30

Closed cristijora closed 6 years ago

cristijora commented 6 years ago

Version

Latest

Reproduction link

https://github.com/cristijora/vue-cli-element-ui

Steps to reproduce

  1. Init repo
  2. Try to run yarn serve

What is expected?

Babel plugin component installation doesn't fail

What is actually happening?

https://www.npmjs.com/package/babel-plugin-component The plugin is not applied and the webpack server fails.

Module build failed: Error: .plugins[0][1] must be an object, false, or undefined at assertPluginItem (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/validation/option-assertions.js:155:15) at /Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/validation/option-assertions.js:132:14 at Array.forEach () at assertPluginList (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/validation/option-assertions.js:131:9) at /Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/validation/options.js:83:20 at Array.forEach () at validate (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/validation/options.js:61:21) at /Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/config-chain.js:136:36 at cachedFunction (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/caching.js:40:17) at init (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/config-chain.js:117:12) at /Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/config-chain.js:201:17 at buildRootChain (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/config-chain.js:82:20) at loadConfig (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/config/index.js:50:53) at transformSync (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/transform-sync.js:13:36) at Object.transform (/Users/cristij/CreativeTim/new-proj/node_modules/@babel/core/lib/transform.js:20:65) at transpile (/Users/cristij/CreativeTim/new-proj/node_modules/babel-loader/lib/index.js:55:20) at Object.module.exports (/Users/cristij/CreativeTim/new-proj/node_modules/babel-loader/lib/index.js:179:20)

@ multi (webpack)-dev-server/client?http://localhost:8082/ (webpack)/hot/dev-server.js ./src/main.js


Vue-cli issue https://github.com/vuejs/vue-cli/issues/739

cristijora commented 6 years ago

This happens because the configuration from docs http://element.eleme.io/#/en-US/component/quickstart#on-demand

 "plugins": [["component", [
    {
      "libraryName": "element-ui",
      "styleLibraryName": "theme-chalk"
    }
  ]]]

Should be

 "plugins": [["component", {
      "libraryName": "element-ui",
      "styleLibraryName": "theme-chalk"
    }
  ]]

Without [] in the optios