[Vuejs]-How to auto-import composables/node_modules with unplugin-vue-components package?

3👍

unplugin-vue-components plugin is meant to import components. If you want to import JS files (and more specifically, JS variables) you can use this plugin: https://github.com/antfu/unplugin-auto-import

Beside the ability to import popular library like axios, you can also add your local ones using dir porperty.

 // Auto import for module exports under directories
  // by default it only scan one level of modules under the directory
  dirs: [
    // './hooks',
    // './composables' // only root modules
    // './composables/**', // all nested modules
    // ...
  ],

Refer to readme for more information.

Leave a comment