【问题标题】:These dependencies were not found Antdv modularized antd没有找到这些依赖 Antdv 模块化 antd
【发布时间】:2021-11-30 05:54:39
【问题描述】:

我正在使用带有 babel-plugin-import 的模块化 antdv,当 import InputSearch 向我抛出标题中描述的错误时。

  • “ant-design-vue”:“^2.2.8”
  • “vue”:“^3.0.0”
// main.js

import { createApp } from "vue";
import App from "./App.vue";
import { ConfigProvider, Button, Form, Input, InputSearch } from "ant-design-vue";

import "./styles/index.less";

const app = createApp(App);

app.use(ConfigProvider);
app.use(Button);
app.use(Form);
app.use(Input);
app.use(InputSearch);

app.mount("#app");

显示的错误:

These dependencies were not found:

* ant-design-vue/es/input-search in ./src/main.js
* ant-design-vue/es/input-search/style in ./src/main.js 
// babel.config.js

module.exports = {
  presets: ["@vue/cli-plugin-babel/preset"],
  plugins: [
    [
      "import",
      { libraryName: "ant-design-vue", libraryDirectory: "es", style: true }
    ] // `style: true` for less
  ]
};

【问题讨论】:

    标签: vue.js antd vuejs3 antdv ant-design-vue


    【解决方案1】:

    解决方案是去掉 InputSearch,只在使用 vuejs 时使用 Input,它可以工作。

    import {
      ConfigProvider,
      Button,
      Form,
      Input,
    // InputSearch // <--- remove it
    } from "ant-design-vue";
    

    【讨论】:

      猜你喜欢
      • 2019-01-23
      • 1970-01-01
      • 2018-10-31
      • 2017-12-05
      • 2017-10-10
      • 1970-01-01
      • 2019-09-17
      • 2021-09-09
      • 2023-03-29
      相关资源
      最近更新 更多