{"id":16583975,"url":"https://github.com/pocka/vue-docgen-loader","last_synced_at":"2025-04-05T17:07:58.604Z","repository":{"id":36123919,"uuid":"221621826","full_name":"pocka/vue-docgen-loader","owner":"pocka","description":"Vue docgen loader for webpack","archived":false,"fork":false,"pushed_at":"2024-10-29T06:22:06.000Z","size":85,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T16:09:00.646Z","etag":null,"topics":["loader","vue","vue-docgen-api","webpack"],"latest_commit_sha":null,"homepage":null,"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/pocka.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-14T05:49:54.000Z","updated_at":"2024-10-29T06:20:49.000Z","dependencies_parsed_at":"2022-08-08T13:16:17.681Z","dependency_job_id":null,"html_url":"https://github.com/pocka/vue-docgen-loader","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocka%2Fvue-docgen-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocka%2Fvue-docgen-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocka%2Fvue-docgen-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocka%2Fvue-docgen-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pocka","download_url":"https://codeload.github.com/pocka/vue-docgen-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247369952,"owners_count":20927928,"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":["loader","vue","vue-docgen-api","webpack"],"created_at":"2024-10-11T22:43:39.482Z","updated_at":"2025-04-05T17:07:58.580Z","avatar_url":"https://github.com/pocka.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-docgen-loader\n\n[![Current status of Test and Lint workflow](https://github.com/pocka/vue-docgen-loader/workflows/Test%20and%20Lint/badge.svg)](https://github.com/pocka/vue-docgen-loader/actions)\n[![Current status of Publish package workflow](https://github.com/pocka/vue-docgen-loader/workflows/Publish%20package/badge.svg)](https://github.com/pocka/vue-docgen-loader/actions)\n\n[![npm](https://img.shields.io/npm/v/vue-docgen-loader)](https://www.npmjs.com/package/vue-docgen-loader)\n[![npm](https://img.shields.io/npm/dm/vue-docgen-loader)](https://www.npmjs.com/package/vue-docgen-loader)\n\nThis package allows parsing Vue component file with [vue-docgen-api](https://github.com/vue-styleguidist/vue-styleguidist/tree/dev/packages/vue-docgen-api) then injecting the result into the output file.\n\n## Getting Started\n\nFirst, install the loader and vue-docgen-api.\n\n```sh\n$ yarn add -D vue-docgen-loader vue-docgen-api\n# or npm\n# $ npm i -D vue-docgen-loader vue-docgen-api\n```\n\nThen add the loader to your webpack config file.\n**Please make sure to run the loader at the last of the loader chain**.\n\n```js\nimport MyComponent from './my-component.vue'\n\nVue.extend({\n  // You can use the components as usual\n  components: { MyComponent }\n})\n```\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.vue$/,\n        use: 'vue-loader'\n      },\n      {\n        // You also can put this loader above, but I recommend to use\n        // a separeted rule with enforce: 'post' for maintainability\n        // and simplicity. For example, you can enable the loader only\n        // for development build.\n        test: /\\.vue$/,\n        use: 'vue-docgen-loader',\n        enforce: 'post'\n      }\n    ]\n  },\n  plugins: [new VueLoaderPlugin()]\n}\n```\n\nIf you want to apply this loader to non-SFC files like below, you also need to\nsetup a rule for them. This works only with vue-docgen-api \u003e= 4.0.0.\n\n```js\n// my-button.js\nimport Vue from 'vue'\n\nexport const MyButton = Vue.extend({\n  props: {\n    foo: {\n      type: String\n    }\n  },\n  template: '\u003cbutton/\u003e'\n})\n```\n\n```js\n// other.js\nimport MyButton from './my-button.js?component'\n```\n\n```js\n// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      // Please make sure to apply the loader only for Vue components: In this\n      // sample, only modules imported with ?component query will match.\n      //\n      // IMPORTANT!\n      // Do not use ?vue query if you're using vue-loader. It will sliently inject\n      // .js?vue rule into rules array and it breaks the module.\n      {\n        test: /\\.js$/,\n        resourceQuery: /component/,\n        use: 'vue-docgen-loader',\n        enforce: 'post'\n      }\n    ]\n  }\n}\n```\n\n## Options\n\nYou can pass options for vue-docgen-api through `docgenOptions` and specify the property name the loader inject docgen result at.\n\n```js\n{\n  test: /\\.vue$/,\n    loader: 'vue-docgen-loader',\n    options: {\n      docgenOptions: {\n        // options for vue-docgen-api...\n      },\n      // Injected property name\n      injectAt: '__docgenInfo' // default\n    },\n    enforce: 'post'\n}\n```\n\n## Contributing\n\nPlease read our contributing guidelines.\n\n[CONTRIBUTING](./CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocka%2Fvue-docgen-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpocka%2Fvue-docgen-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocka%2Fvue-docgen-loader/lists"}