These dependencies were not found Antdv modularized antd

1k Views Asked by At

I'm using the modularized antdv with babel-plugin-import and when import InputSearch throws me the error described in the title.

  • "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");

the error that shows:

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
  ]
};

1

There are 1 best solutions below

0
On

The solution were remove InputSearch and only use Input in the use of vuejs and it works.

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