{"id":19807919,"url":"https://github.com/jwygithub/vue-cli-plugin-inject-alias","last_synced_at":"2026-01-26T12:14:40.054Z","repository":{"id":65231859,"uuid":"588452279","full_name":"jwyGithub/vue-cli-plugin-inject-alias","owner":"jwyGithub","description":"automatically generate alias based on path","archived":false,"fork":false,"pushed_at":"2024-10-15T03:41:08.000Z","size":476,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T03:47:39.459Z","etag":null,"topics":["alias","vue"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/vue-cli-plugin-inject-alias","language":"TypeScript","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/jwyGithub.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-13T06:37:10.000Z","updated_at":"2024-10-15T03:41:11.000Z","dependencies_parsed_at":"2023-11-07T10:31:08.745Z","dependency_job_id":"521165a1-d0d7-4614-b536-e2ebea41dcf6","html_url":"https://github.com/jwyGithub/vue-cli-plugin-inject-alias","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwyGithub%2Fvue-cli-plugin-inject-alias","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwyGithub%2Fvue-cli-plugin-inject-alias/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwyGithub%2Fvue-cli-plugin-inject-alias/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwyGithub%2Fvue-cli-plugin-inject-alias/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwyGithub","download_url":"https://codeload.github.com/jwyGithub/vue-cli-plugin-inject-alias/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251840283,"owners_count":21652312,"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":["alias","vue"],"created_at":"2024-11-12T09:12:21.909Z","updated_at":"2026-01-26T12:14:40.002Z","avatar_url":"https://github.com/jwyGithub.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"English | [简体中文](https://github.com/jwyGithub/vue-cli-plugin-inject-alias/blob/master/README.zh.md)\n\n# vue-cli-plugin-inject-alias\n\nautomatically generate alias based on path\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/vue-cli-plugin-inject-alias\" alt='version'\u003e\n  \u003cimg src=\"https://img.shields.io/npm/dm/vue-cli-plugin-inject-alias\" alt='download'\u003e\n  \u003cimg src=\"https://img.shields.io/github/issues/jwyGithub/vue-cli-plugin-inject-alias\" alt='issues'\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/jwyGithub/vue-cli-plugin-inject-alias\" alt='license'\u003e\n\u003c/p\u003e\n\u003cbr /\u003e\n\n## Features\n\n-   Support for custom alias prefixes\n-   Supports synchronous mode configuration\n\n## Install\n\n### with pnpm\n\n```sh\npnpm add vue-cli-plugin-inject-alias -D\n```\n\n### with yarn\n\n```sh\nyarn add vue-cli-plugin-inject-alias -D\n```\n\n### with npm\n\n```sh\nnpm install vue-cli-plugin-inject-alias -D\n```\n\n### with vue\n\n```sh\nvue add vue-cli-plugin-inject-alias\n```\n\n## Option\n\n```typescript\nexport interface AutoAlias {\n    /**\n     * @description the root directory where the alias needs to be generated is src by default\n     * @default src\n     */\n    root?: string;\n\n    /**\n     * @description prefix for generating aliases\n     * @default @\n     */\n    prefix?: string;\n\n    /**\n     * @description synchronize the mode of json configuration\n     * @default all\n     */\n    mode?: 'sync' | 'off';\n\n    /**\n     * @description alias configuration file path\n     * @default tsconfig.json\n     */\n    aliasPath?: string;\n}\n```\n\n#### Mode\n\n-   sync : when use `sync`,the plugin will search for `tsconfig.json` or `jsconfig.json` in the root directory of the current project, so please ensure that this file exists in the project. The plugin will automatically generate paths options when running, and then write them to the file without the need for developers to manually add them\n\n\u003e vue.config.js\n\n```javascript\nconst { resolve } = require('node:path');\nmodule.exports = defineConfig({\n    // other config\n    transpileDependencies: true,\n    pluginOptions: {\n        'vue-cli-plugin-inject-alias': {\n            mode: 'sync',\n            prefix: '@',\n            root: resolve(__dirname, './src'),\n            aliasPath: path.resolve(__dirname, './tsconfig.json')\n        }\n    }\n});\n```\n\n\u003e tsconfig.json / jsconfig.json\n\n```json\n{\n    \"compilerOptions\": {\n        \"baseUrl\": \"./\"\n        // ...\n    }\n}\n```\n\n## example\n\n    |-- src\n        |-- plugins\n        |-- router\n        |-- scss\n        |-- store\n        |-- utils\n        |-- views\n        |-- ....\n\n```javascript\n// import xxx from '@plugins/xxx';\n// import xxx from '@router/xxx';\n// import xxx from '@scss/xxx';\n// import xxx from '@store/xxx';\n// import xxx from '@utils/xxx';\n// import xxx from '@views/xxx';\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwygithub%2Fvue-cli-plugin-inject-alias","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwygithub%2Fvue-cli-plugin-inject-alias","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwygithub%2Fvue-cli-plugin-inject-alias/lists"}