Ant-design-vue: Failed to resolve directive: ant-input

Created on 17 Aug 2018  ·  8Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.0.3

Environment

electron1.8.7, "vee-validate": "^2.1.0-beta.7", "vue": "^2.3.3",

Reproduction link

Edit on CodeSandbox

Steps to reproduce

  1. 打开https://codesandbox.io/s/r70mz1q13m
  2. 到app.vue
  3. 报错a-input找到不
    vue.esm.js?efeb:591 [Vue warn]: Failed to resolve directive: ant-input
    (found in )

What is expected?

没有warning

What is actually happening?

有warning


vue-antd-ui 版本没这个问题

outdated

Most helpful comment

I think i found the solution, this was happened when you use electron-vue to build your project, i have got the same problem

Failed to resolve directive: ant-input

and <a-tooltip> didn't work

so, if you are using electron-vue you should change the following config at .electron-vue/webpack.renderer.config.js add ant-design-vue to whitelist

/**
 * List of node_modules to include in webpack bundle
 *
 * Required for specific packages like Vue UI libraries
 * that provide pure *.vue files that need compiling
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
 */
let whiteListedModules = ['vue', 'ant-design-vue']

如果用 electron-vue 可以改改配置,让 webpack 不认为 ant-design-vue 是外部组件,让 vue-loader 加载即可,另外也不需要额外加载 directive

All 8 comments

same problem.

请提供可运行的复现issue链接

code sand box里面不能重现,不知道是不是打包的问题,还有我的环境是在electron里面使用vue。大神能否自己弄一个electron环境,很好重现。

vue.esm.js?efeb:591 [Vue warn]: Failed to resolve directive: ant-input

(found in <AInput>)
warn @ vue.esm.js?efeb:591
resolveAsset @ vue.esm.js?efeb:1512
normalizeDirectives$1 @ vue.esm.js?efeb:6279
_update @ vue.esm.js?efeb:6203
updateDirectives @ vue.esm.js?efeb:6196
patchVnode @ vue.esm.js?efeb:5931
patch @ vue.esm.js?efeb:6096
Vue._update @ vue.esm.js?efeb:2670
updateComponent @ vue.esm.js?efeb:2788
get @ vue.esm.js?efeb:3142
run @ vue.esm.js?efeb:3219
flushSchedulerQueue @ vue.esm.js?efeb:2981
(anonymous) @ vue.esm.js?efeb:1837
flushCallbacks @ vue.esm.js?efeb:1758
vue.esm.js?efeb:591 [Vue warn]: Failed to resolve directive: ant-input

(found in <AInput>)

和electron没有任何关系,和vee-validate也没有任何关系,

目测是你的构建工具打包的问题,如果实在找不到问题,可以入口处添加如下代码注册指令:

import antInputDirective from 'ant-design-vue/es/_util/antInputDirective'
Vue.use(antInputDirective)

I think i found the solution, this was happened when you use electron-vue to build your project, i have got the same problem

Failed to resolve directive: ant-input

and <a-tooltip> didn't work

so, if you are using electron-vue you should change the following config at .electron-vue/webpack.renderer.config.js add ant-design-vue to whitelist

/**
 * List of node_modules to include in webpack bundle
 *
 * Required for specific packages like Vue UI libraries
 * that provide pure *.vue files that need compiling
 * https://simulatedgreg.gitbooks.io/electron-vue/content/en/webpack-configurations.html#white-listing-externals
 */
let whiteListedModules = ['vue', 'ant-design-vue']

如果用 electron-vue 可以改改配置,让 webpack 不认为 ant-design-vue 是外部组件,让 vue-loader 加载即可,另外也不需要额外加载 directive

感谢你解决了我的问题

感谢 @hefengxian 提供的建议,修复了我的问题。

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AhJane picture AhJane  ·  3Comments

AndesLai picture AndesLai  ·  4Comments

fengqinglingyu picture fengqinglingyu  ·  5Comments

kdashsoul picture kdashsoul  ·  5Comments

yiptsangkin picture yiptsangkin  ·  3Comments