{"id":16184213,"url":"https://github.com/hunterliu1003/vue-automatic-import-loader","last_synced_at":"2025-06-18T03:32:45.949Z","repository":{"id":39379723,"uuid":"209717403","full_name":"hunterliu1003/vue-automatic-import-loader","owner":"hunterliu1003","description":"📦Using a match function to automatic import your own Vue project's components","archived":false,"fork":false,"pushed_at":"2022-12-11T06:31:29.000Z","size":1910,"stargazers_count":23,"open_issues_count":18,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T19:55:50.965Z","etag":null,"topics":["vue","vue-automatic","vue-automatic-import-loader","webpack-loader","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vue-automatic-import-loader","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hunterliu1003.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-20T06:07:41.000Z","updated_at":"2025-03-07T06:25:56.000Z","dependencies_parsed_at":"2023-01-26T17:16:32.752Z","dependency_job_id":null,"html_url":"https://github.com/hunterliu1003/vue-automatic-import-loader","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/hunterliu1003/vue-automatic-import-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterliu1003%2Fvue-automatic-import-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterliu1003%2Fvue-automatic-import-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterliu1003%2Fvue-automatic-import-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterliu1003%2Fvue-automatic-import-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hunterliu1003","download_url":"https://codeload.github.com/hunterliu1003/vue-automatic-import-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hunterliu1003%2Fvue-automatic-import-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260481751,"owners_count":23015799,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["vue","vue-automatic","vue-automatic-import-loader","webpack-loader","webpack-plugin"],"created_at":"2024-10-10T07:09:24.646Z","updated_at":"2025-06-18T03:32:40.938Z","avatar_url":"https://github.com/hunterliu1003.png","language":"JavaScript","funding_links":[],"categories":["Components \u0026 Libraries","JavaScript","Utilities [🔝](#readme)"],"sub_categories":["Utilities"],"readme":"# vue-automatic-import-loader\n\nUsing a match function to automatic import your own project's components\n\nThis repo copy from [vuetify-loader](https://github.com/vuetifyjs/vuetify-loader) and remove the vuetify part.\n\n## Introduction\n\n**vue-automatic-import-loader** is a webpack plugin that automatically import SFC.\n\nHere is the example:\n\n```html\n\u003ctemplate\u003e\n  \u003cbase-button\u003eThis is a button component\u003c/base-button\u003e\n\u003c/template\u003e\n```\n\nwill be automatically compiled to:\n\n```html\n\u003ctemplate\u003e\n  \u003cbase-button\u003eThis is a button component\u003c/base-button\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import BaseButton from '@/components/base/Button.vue'\n\n  export default {\n    components: {\n      BaseButton\n    }\n  }\n\u003c/script\u003e\n```\n\n## Run example project\n\n```bash\n$ git clone https://github.com/hunterliu1003/vue-automatic-import-loader.git\n$ cd vue-automatic-import-loader/dev\n$ yarn install\n$ yarn serve\n```\nThen you can see demo in http://localhost:8080/\n\n## Usage\n\n### Install package\n\n```bash\n$ npm install --save vue-automatic-import-loader\n# or\n$ yarn add vue-automatic-import-loader\n```\n\n### Vue CLI 3\n\nin vue.config.js:\n\n```js\nconst VueAutomaticImportPlugin = require('vue-automatic-import-loader/lib/plugin')\n\nmodule.exports = {\n  configureWebpack: {\n    plugins: [\n      new VueAutomaticImportPlugin({\n        match(originalTag, { kebabTag, camelTag }) {\n          /**\n           * This function will be called for every tag used in each vue component\n           * It should return an array, the first element will be inserted into the\n           * components array, the second should be a corresponding import\n           *\n           * originalTag - the tag as it was originally used in the template\n           * kebabTag    - the tag normalised to kebab-case\n           * camelTag    - the tag normalised to PascalCase\n           * path        - a relative path to the current .vue file\n           * component   - a parsed representation of the current component\n           */\n          if (kebabTag.startsWith('base-')) {\n            return [\n              camelTag,\n              `import ${camelTag} from '@/components/base/${camelTag}.vue'`\n            ]\n          }\n        }\n      })\n    ]\n  }\n}\n```\n\n### Nuxt.js\n\nin nuxt.config.js:\n\n```js\nimport VueAutomaticImportPlugin from 'vue-automatic-import-loader/lib/plugin'\n\nexport default {\n  build: {\n    plugins: [\n      new VueAutomaticImportPlugin({\n        match(originalTag, { kebabTag, camelTag, path, component }) {\n          /**\n           * This function will be called for every tag used in each vue component\n           * It should return an array, the first element will be inserted into the\n           * components array, the second should be a corresponding import\n           *\n           * originalTag - the tag as it was originally used in the template\n           * kebabTag    - the tag normalised to kebab-case\n           * camelTag    - the tag normalised to PascalCase\n           * path        - a relative path to the current .vue file\n           * component   - a parsed representation of the current component\n           */\n          if (kebabTag.startsWith('base-')) {\n            return [\n              camelTag,\n              `import ${camelTag} from '@/components/base/${camelTag}.vue'`\n            ]\n          }\n        }\n      })\n    ]\n  }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterliu1003%2Fvue-automatic-import-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhunterliu1003%2Fvue-automatic-import-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhunterliu1003%2Fvue-automatic-import-loader/lists"}