{"id":15616370,"url":"https://github.com/vqun/alias-loader","last_synced_at":"2026-05-03T19:31:32.750Z","repository":{"id":74407141,"uuid":"92373102","full_name":"vqun/alias-loader","owner":"vqun","description":"A webpack loader used to resolve alias (typically in .less)","archived":false,"fork":false,"pushed_at":"2017-05-25T06:38:00.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T01:22:18.812Z","etag":null,"topics":["alias-loader","loader","webpack-loader"],"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/vqun.png","metadata":{"files":{"readme":"README.md","changelog":null,"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-05-25T06:36:38.000Z","updated_at":"2017-12-15T10:34:08.000Z","dependencies_parsed_at":"2023-04-22T00:10:18.776Z","dependency_job_id":null,"html_url":"https://github.com/vqun/alias-loader","commit_stats":{"total_commits":2,"total_committers":2,"mean_commits":1.0,"dds":0.5,"last_synced_commit":"e3e101bdf1248910eba27b40579172e67a86b216"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vqun/alias-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vqun%2Falias-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vqun%2Falias-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vqun%2Falias-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vqun%2Falias-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vqun","download_url":"https://codeload.github.com/vqun/alias-loader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vqun%2Falias-loader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32582487,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["alias-loader","loader","webpack-loader"],"created_at":"2024-10-03T07:07:23.474Z","updated_at":"2026-05-03T19:31:32.732Z","avatar_url":"https://github.com/vqun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alias-loader\nA webpack loader used to resolve alias.\n\nTypically when we use less in our project, the less-loader cannot resolve the aliases defined in webpack.config.resolve.alias.\n\nMany times, our less file is imported to other one, and they may be in different contexts. For example:\n\nIf we have `/root/styles/variables.less`, and `/root/components/button/button.less`, we need the `variables.less` to be imported to `button.less`\n\n**Without `alias-loader`**, we should import it like this:\n```css\n  /* in button.less: */\n  @import '../../styles/variable.less';\n  /* ... other less code */\n```\nthat means we must actually know what the relative between variables.less and button.less, and this is really messy.\n\nBut now, with `alias-loader`, things is extremely simple. we just need add `alias-loader` to less file resolve loaders, and define the alias, as:\n\n```javascript\n  // in webpack.config.js, with webpack \u003e v2.0.0\n  resolve: {\n    alias: {\n      '@styles': path.join(__dirname, 'styles'),\n      // ... and so on\n    }\n  },\n  module: {\n    rules: [{\n      test: /\\.less$/,\n      use: ['style-loader', 'css-loader', 'less-laoder', 'alias-loader']\n    }]\n  }\n\n  // also you can define your own aliases for alias-loader in the option:\n  use: ['style-loader', 'css-loader', 'less-laoder', {\n    loader: 'alias-loader',\n    options: {\n      alias: {\n        // aliases for alias-loader here\n      }\n    }\n  }]\n```\nthen, just modify our button.less:\n```css\n  /* in button.less: */\n  @import '@styles/variables.less';\n  /* ... other less code */\n```\n\nAlso, you can use `alias-laoder` for any file typ as you want, but I really recomend it just on the case as `.less` files.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvqun%2Falias-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvqun%2Falias-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvqun%2Falias-loader/lists"}