vueComponent / vue-cli-plugin-ant-design

vue-cli 3 plugin to add ant-design-vue
MIT License
85 stars 8 forks source link

Import on demand install fails without first preparing babel-plugin-import #10

Closed n-smits closed 4 years ago

n-smits commented 4 years ago
vue create antsy
> default (babel, eslint)
cd antsy
vue add ant-design
> Import on demand
> en_US

This fails for me in postinstall. (Fully import works.) Fixed with as per advanced guides from ant docs (npm i babel-plugin-import -D and modify babel.config.js before adding plugin).

EDIT: And furthermore, still needed to remove LocaleProvider from src/plugins/ though the install was was without errors (errors shown in dev tools console). ๐Ÿ˜•

Would you kindly update deps so it's not manual.

(Also, there are some prototype pollution warnings on npm audit)

Full error print out below (cleared funding and vulnerabilities notes).

Cheers :)

> vue add ant-design

๐Ÿ“ฆ  Installing vue-cli-plugin-ant-design...

+ vue-cli-plugin-ant-design@1.0.0
added 1 package from 1 contributor and audited 25497 packages in 4.97s

(fund and vulnerabilities notes)

โœ”  Successfully installed plugin: vue-cli-plugin-ant-design

? How do you want to import Ant-Design-Vue? Import on demand
? Choose the locale you want to load en_US

๐Ÿš€  Invoking generator for vue-cli-plugin-ant-design...
๐Ÿ“ฆ  Installing additional dependencies...

> core-js@2.6.11 postinstall /Users/Nikola/dev/antsy/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

> ant-design-vue@1.5.3 postinstall /Users/Nikola/dev/antsy/node_modules/ant-design-vue
> node scripts/postinstall || echo "ignore"

added 68 packages from 93 contributors and audited 25642 packages in 5.029s

42 packages are looking for funding
  run `npm fund` for details

found 5 vulnerabilities (4 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
โ ‹  Running completion hooks...error: 'LocaleProvider' is not defined (no-undef) at src/plugins/ant-design-vue.js:3:15:
  1 | import Vue from 'vue'
  2 | import { Pagination, Button } from 'ant-design-vue'
> 3 | Vue.component(LocaleProvider.name, LocaleProvider)
    |               ^
  4 | Vue.component(Pagination.name, Pagination)
  5 | Vue.component(Button.name, Button)
  6 | 

error: 'LocaleProvider' is not defined (no-undef) at src/plugins/ant-design-vue.js:3:36:
  1 | import Vue from 'vue'
  2 | import { Pagination, Button } from 'ant-design-vue'
> 3 | Vue.component(LocaleProvider.name, LocaleProvider)
    |                                    ^
  4 | Vue.component(Pagination.name, Pagination)
  5 | Vue.component(Button.name, Button)
  6 | 

2 errors found.
wangxueliang commented 4 years ago

Please try again๏ผŒtks