{"id":51425168,"url":"https://github.com/ignwombat/esbuild-fix-imports","last_synced_at":"2026-07-05T02:01:04.207Z","repository":{"id":363215918,"uuid":"1261933784","full_name":"ignwombat/esbuild-fix-imports","owner":"ignwombat","description":"import/require transformer for EsBuild. Supports TsConfig Paths.","archived":false,"fork":false,"pushed_at":"2026-07-02T09:36:46.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-02T10:25:58.498Z","etag":null,"topics":["cjs","commonjs","directory","ecmascript","esbuild","esm","esmodule","export","folder","import","require","tsconfig","typescript"],"latest_commit_sha":null,"homepage":"","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/ignwombat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-07T10:57:53.000Z","updated_at":"2026-07-02T09:36:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ignwombat/esbuild-fix-imports","commit_stats":null,"previous_names":["ignwombat/esbuild-fix-imports"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ignwombat/esbuild-fix-imports","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignwombat%2Fesbuild-fix-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignwombat%2Fesbuild-fix-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignwombat%2Fesbuild-fix-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignwombat%2Fesbuild-fix-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignwombat","download_url":"https://codeload.github.com/ignwombat/esbuild-fix-imports/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignwombat%2Fesbuild-fix-imports/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35141083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cjs","commonjs","directory","ecmascript","esbuild","esm","esmodule","export","folder","import","require","tsconfig","typescript"],"created_at":"2026-07-05T02:00:48.352Z","updated_at":"2026-07-05T02:01:04.186Z","avatar_url":"https://github.com/ignwombat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EsBuild Fix Imports\nimport/require transformer for esbuild. Supports TsConfig Paths.\n\nNot to be confused with [EsBuild Fix Imports Plugin](https://github.com/aymericzip/esbuild-fix-imports-plugin).\nThese plugins differ in that this one walks through the code and only modifies import/export strings, instead of relying purely on RegEx patterns.\nIf the other plugin works in your use case, there is no need to install this one.\n\n\u003e While EsBuild can *resolve* your files, when bundling is disabled, it won't automatically change the import paths,\nwhich can cause problems when you want to compile your project to both ESM and CommonJS, or use simpler imports in ESM.\nThis plugin aims to solve that issue.\n\nWhen bundling is enabled, this plugin simply acts as a TsConfig Paths resolver.\n\n\u003e One of the great strengths this plugin provides, is that you can easily set `\"type\": \"module\"` in your package.json without breaking the entire project.\n\n**tsconfig.json `baseUrl` is deprecated. This plugin only handles `rootDir`.**\n\n\u003e This plugin uses itself to get compiled into JavaScript. How neat!\n\n## Installation\n```sh\nnpm install --save-dev esbuild-fix-imports\n```\n\n\u003e The plugin has a minimal amount of dependencies, and only relies on [get-tsconfig](https://www.npmjs.com/package/get-tsconfig)\n\u003e and, of course, [EsBuild](https://www.npmjs.com/package/esbuild).\n\n## Usage\n```ts\nimport { build } from 'esbuild';\nimport { FixImportsPlugin } from 'esbuild-fix-imports';\n\n// Can build to either ESM or CJS without modifying the source\nbuild({\n    // ...\n    bundle: false,\n    plugins: [\n        // ...\n        FixImportsPlugin({\n            outputExtension: '.js'\n        })\n    ]\n});\n\n// With bundle: true, the plugin will simply resolve TsConfig Paths\n// Most options are not used by the plugin in this mode\nbuild({\n    // ...\n    bundle: true,\n    plugins: [\n        // ...\n        FixImportsPlugin()\n    ]\n})\n```\n\n## Options\n**All options are optional.**\n\n### `inputExtension` (string)\nFile extension to use when searching for the import file. Defaults to the same extension as the input file.\n```ts\n// Use .ts when searching for files\n{\n    inputExtension: '.ts'\n}\n```\n\n### `outputExtension` (string)\nFile extension to use in the output import. Defaults to `'.js'`.\n```ts\n// Use .cjs in the output import\n{\n    outputExtension: '.cjs'\n}\n```\n\n### `ignoreDynamicImports` (boolean)\nSome projects rely on dynamic ESM imports being untouched.\nSet this to true to ignore dynamic imports.\n```ts\n// Leave dynamic imports untouched\n{\n    ignoreDynamicImports: true\n}\n```\n\n### `filter` (RegExp)\nRegEx filter to detect input files. By default detects all TypeScript files.\n```ts\n// All combinations of js, jsx, ts, tsx, etc.\n{\n    filter: /\\.[cm]?[tj]sx?$/\n}\n```\n\n### `tsconfigPaths` (string | boolean | Object)\nBy default, this plugin will auto-import your project's tsconfig. If needed, you may pass either the paths or tsconfig location.\nSet to false to disable tsconfig paths resolution.\n```ts\n// tsconfig file location\n{\n    tsconfigPaths: 'tsconfig.paths.json'\n}\n\n// explicit tsconfig paths\n{\n    tsconfigPaths: {\n        '@utils/*': ['./src/utils/*'],\n        '@/*': ['./src/*']\n    }\n}\n\n// no tsconfig paths\n{\n    tsconfigPaths: false\n}\n```\n\n### `rootDir` (string | boolean)\nBy default, this plugin will use the rootDir defined by the project's tsconfig (or the current working directory.)\nIf needed, you may pass a separate rootDir location.\nSet to false to always use the current working directory.\n```ts\n// set rootDir to src/app\n{\n    rootDir: './src/app'\n}\n\n// force rootDir to the current working directory\n{\n    rootDir: false\n}\n```\n\n### `loader` (string | Function)\nOptional custom resolver for what loader to use. Either pass a loader's name, or a function to resolve the loader.\n```ts\n// Basic TypeScript loader\n{\n    loader: 'ts'\n}\n\n// Dynamically choose between ts and tsx\n{\n    loader: ext =\u003e ext.endsWith('x')\n        ? 'tsx'\n        : 'ts'\n}\n```\n\n## Disclaimer\nWhile it appears to correctly transform paths in most projects,\nthere's no guarantee that this plugin will work flawlessly every time.\nIt was made with intermediate Node.js + EsBuild knowdlege.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignwombat%2Fesbuild-fix-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignwombat%2Fesbuild-fix-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignwombat%2Fesbuild-fix-imports/lists"}