{"id":13601950,"url":"https://github.com/dividab/tsconfig-paths-webpack-plugin","last_synced_at":"2025-04-13T00:37:16.021Z","repository":{"id":40432360,"uuid":"96713981","full_name":"dividab/tsconfig-paths-webpack-plugin","owner":"dividab","description":"Load modules according to tsconfig paths in webpack.","archived":false,"fork":false,"pushed_at":"2024-11-15T07:09:05.000Z","size":543,"stargazers_count":612,"open_issues_count":40,"forks_count":51,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-13T00:37:10.601Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dividab.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":"2017-07-09T22:01:44.000Z","updated_at":"2025-04-07T18:30:14.000Z","dependencies_parsed_at":"2024-06-18T11:32:05.791Z","dependency_job_id":"934802a3-cf95-45f8-a8f5-0a43d99a1669","html_url":"https://github.com/dividab/tsconfig-paths-webpack-plugin","commit_stats":{"total_commits":174,"total_committers":22,"mean_commits":7.909090909090909,"dds":"0.13793103448275867","last_synced_commit":"a32577c76400a76c667e6093632386a86651422d"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dividab%2Ftsconfig-paths-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dividab%2Ftsconfig-paths-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dividab%2Ftsconfig-paths-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dividab%2Ftsconfig-paths-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dividab","download_url":"https://codeload.github.com/dividab/tsconfig-paths-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650414,"owners_count":21139671,"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":[],"created_at":"2024-08-01T18:01:10.459Z","updated_at":"2025-04-13T00:37:16.000Z","avatar_url":"https://github.com/dividab.png","language":"TypeScript","readme":"# tsconfig-paths-webpack-plugin\n\n[![npm version][version-image]][version-url]\n[![build][build-image]][build-url]\n[![Coverage Status][codecov-image]][codecov-url]\n[![code style: prettier][prettier-image]][prettier-url]\n[![MIT license][license-image]][license-url]\n\nUse this to load modules whose location is specified in the `paths` section of\n`tsconfig.json` when using webpack. This package provides the functionality of\nthe [tsconfig-paths](https://www.npmjs.com/package/tsconfig-paths) package but\nas a webpack plug-in.\n\nUsing this plugin means that you should no longer need to add `alias` entries in\nyour `webpack.config.js` which correspond to the `paths` entries in your\n`tsconfig.json`. This plugin creates those `alias` entries for you, so you don't\nhave to!\n\n## How to install\n\n\u003e NOTE: If you are using webpack 4 you need to use version \u003e= 3.0.0 (which is aso backwards compatible with webpack 3).\n\n```\nyarn add --dev tsconfig-paths-webpack-plugin\n```\n\nor\n\n```\nnpm install --save-dev tsconfig-paths-webpack-plugin\n```\n\n## How to use\n\nIn your webpack config add this:\n\n```js\nconst TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');\n\nmodule.exports = {\n  ...\n  resolve: {\n    plugins: [new TsconfigPathsPlugin({/* options: see below */})]\n  }\n  ...\n}\n```\n\n**Notice that the plugin is placed in the `resolve.plugins` section of the configuration.** `tsconfig-paths-webpack-plugin` is a resolve plugin and should only be placed in this part of the configuration. Don't confuse this with the plugins array at the root of the webpack configuration object.\n\nIf you're using `allowJs` in `tsconfig.json`, or allow other non-TS extensions in webpack, **make sure you set `extensions` option in sync with your webpack config.**\n\n## Options\n\n#### configFile _(string) (default='tsconfig.json')_\n\nAllows you to specify where to find the TypeScript configuration file.\n\nYou may provide\n\n- just a file name. The plugin will search for the filename using the built-in\n  logic in the `tsconfig-paths` package. The search will start at `cwd`.\n- a relative path to the configuration file. It will be resolved relative to\n  `cwd`.\n- an absolute path to the configuration file.\n\n\u003e The use of `cwd` as default above is not optimal but we've found no better\n\u003e solution yet. If you have a suggestion please file an issue.\n\n#### extensions _(string[]) (default=[\".ts\", \".tsx\"])_\n\nAn array of the extensions that will be tried during resolve. Ideally this would be the same as the extensions from the webpack config but it seems resolver plug-ins does not have access to this information so you need to specify it again for the plugin.\n\n#### baseUrl _(string) (default=undefined)_\n\nThis allows you to override the `baseUrl` found in tsconfig.json. The baseUrl specifies from which directory `paths` should be resolved. So this option enabled you to resolve from another directory than the one where tsconfig.json is located. This can be useful if you want to use webpack with `tsc --watch` instead of a typescript loader. If this option is `undefined` then the `baseUrl` from tsconfig.json will be used.\n\n#### mainFields _((string | string[])[]) (default=[\"main\"])_\n\nAn array of the field names that should be considered when resolving packages. Ideally this would be the same as the mainFields from the webpack config but it seems resolver plug-ins does not have access to this infomration so you need to specify it again for the plugin.\n\n#### silent _(boolean) (default=false)_\n\nIf true, no console.log messages will be emitted. Note that most error messages\nare emitted via webpack which is not affected by this flag.\n\n#### logLevel _(string) (default=warn)_\n\nCan be `info`, `warn` or `error` which limits the log output to the specified\nlog level. Beware of the fact that errors are written to stderr and everything\nelse is written to stderr (or stdout if logInfoToStdOut is true).\n\n#### colors _(boolean) (default=true)_\n\nIf `false`, disables built-in colors in logger messages.\n\n#### logInfoToStdOut _(boolean) (default=false)_\n\nThis is important if you read from stdout or stderr and for proper error\nhandling. The default value ensures that you can read from stdout e.g. via pipes\nor you use webpack -j to generate json output.\n\n#### references _(string[]) (default=undefined)\n\nSupport for [Typescript Project References](https://www.typescriptlang.org/docs/handbook/project-references.html).\n\n## Typescript support\n\nThis package has typescript typings included. If your webpack config is using typescript, you can use this syntax to import the default export:\n\n```ts\nimport TsconfigPathsPlugin from \"tsconfig-paths-webpack-plugin\";\n```\n\nOr you can use this syntax to import the named export:\n\n```ts\nimport { TsconfigPathsPlugin } from \"tsconfig-paths-webpack-plugin\";\n```\n\n## How to test\n\nTo run the provided example:\n\n```\nyarn example\n```\n\n## How to publish\n\n```\nyarn version --patch\nyarn version --minor\nyarn version --major\n```\n\n## Prior work\n\nThis project uses work done in the\n[awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader).\n\n[version-image]: https://img.shields.io/npm/v/tsconfig-paths-webpack-plugin.svg?style=flat\n[version-url]: https://www.npmjs.com/package/tsconfig-paths-webpack-plugin\n[build-image]: https://github.com/dividab/tsconfig-paths-webpack-plugin/workflows/CI/badge.svg\n[build-url]: https://github.com/dividab/tsconfig-paths-webpack-plugin/actions/workflows/ci.yml?query=branch%3Amaster\n[codecov-image]: https://codecov.io/gh/dividab/tsconfig-paths-webpack-plugin/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/dividab/tsconfig-paths-webpack-plugin\n[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat\n[prettier-url]: https://github.com/prettier/prettier\n[license-image]: https://img.shields.io/github/license/jonaskello/tsconfig-paths-webpack-plugin.svg?style=flat\n[license-url]: https://opensource.org/licenses/MIT\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdividab%2Ftsconfig-paths-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdividab%2Ftsconfig-paths-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdividab%2Ftsconfig-paths-webpack-plugin/lists"}