{"id":13739571,"url":"https://github.com/miketamis/babel-plugin-hash-resolve","last_synced_at":"2025-05-08T19:34:24.770Z","repository":{"id":143383072,"uuid":"135948936","full_name":"miketamis/babel-plugin-hash-resolve","owner":"miketamis","description":"Lets you use #Paths instead of '../../../lib/helper.js' it becomes just '#/lib/helper.js'","archived":false,"fork":false,"pushed_at":"2020-04-28T22:58:18.000Z","size":4,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T09:05:56.606Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miketamis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2018-06-03T23:35:42.000Z","updated_at":"2024-07-16T14:29:31.000Z","dependencies_parsed_at":"2023-07-25T21:16:59.090Z","dependency_job_id":null,"html_url":"https://github.com/miketamis/babel-plugin-hash-resolve","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miketamis%2Fbabel-plugin-hash-resolve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miketamis%2Fbabel-plugin-hash-resolve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miketamis%2Fbabel-plugin-hash-resolve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miketamis%2Fbabel-plugin-hash-resolve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miketamis","download_url":"https://codeload.github.com/miketamis/babel-plugin-hash-resolve/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253135514,"owners_count":21859660,"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-03T04:00:35.347Z","updated_at":"2025-05-08T19:34:24.444Z","avatar_url":"https://github.com/miketamis.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Module Resolution"],"readme":"# babel-plugin-hash-resolve\n\nSick of all those `require('../../../something.js')`  We all are.\nheres another differnet solution to that problem, I call it #paths\n\ninstead of\n\n```js\nimport React, { Component } from 'react'\nimport Container from '../../shared-components/Container'\nimport { colors, fillFields } from '../../shared-components/helpers'\nimport SearchBox from '../../shared-components/SearchBox'\n```\n\nit would be\n\n```js\nimport React, { Component } from 'react'\nimport Container from '#/shared-components/Container'\nimport { colors, fillFields } from '#/shared-components/helpers'\nimport SearchBox from '#/shared-components/SearchBox'\n```\n\n## 1. - How does it work:\n\nIt goes up the up the path, ie if the file is located src/components/SearchComponent/index.js\nit would start by looking for\n`src/components/SearchComponent/shared-components/SearchBox -\u003e ./`\nthen:\n`src/components/shared-components/SearchBox -\u003e ../`\nthen:\n`src/shared-components/SearchBox -\u003e ../../`\nwhich is where the file exists. and therefore the path will be ../../ when compiled.\n\n\n## How to install:\n`npm i --save babel-plugin-hash-resolve` or `yarn add babel-plugin-hash-resolve`\n```json\n// .babelrc\n\"plugins\": [\n    \"babel-plugin-hash-resolve\"\n]\n\n```\n\nif your using eslint you may need to turn these off:\n\n```\n 'import/no-unresolved': 'off',\n 'import/extensions': 'off'\n```\n\n## Other Options:\n\n* https://github.com/patrick-steele-idem/app-module-path-node\n\n* https://lostechies.com/derickbailey/2014/02/20/how-i-work-around-the-require-problem-in-nodejs/\n\nIf you got a differnt solutions to this problem pull request and add it to this list.\n\n## Why I like this method:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiketamis%2Fbabel-plugin-hash-resolve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiketamis%2Fbabel-plugin-hash-resolve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiketamis%2Fbabel-plugin-hash-resolve/lists"}