{"id":21937648,"url":"https://github.com/cap32/file-loader-relative-path-bug","last_synced_at":"2026-05-09T01:12:13.652Z","repository":{"id":88318559,"uuid":"108965430","full_name":"Cap32/file-loader-relative-path-bug","owner":"Cap32","description":null,"archived":false,"fork":false,"pushed_at":"2018-03-05T02:57:29.000Z","size":53,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T13:48:28.779Z","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/Cap32.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,"publiccode":null,"codemeta":null}},"created_at":"2017-10-31T08:18:21.000Z","updated_at":"2017-10-31T08:18:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"b13f27ce-ffea-4103-815c-f5b65391a149","html_url":"https://github.com/Cap32/file-loader-relative-path-bug","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/Cap32%2Ffile-loader-relative-path-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Ffile-loader-relative-path-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Ffile-loader-relative-path-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cap32%2Ffile-loader-relative-path-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cap32","download_url":"https://codeload.github.com/Cap32/file-loader-relative-path-bug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244967912,"owners_count":20540034,"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-11-29T01:21:09.444Z","updated_at":"2026-05-09T01:12:08.618Z","avatar_url":"https://github.com/Cap32.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file-loader-relative-path-bug\n\nThis repo shows some bugs in [file-loader](https://github.com/webpack-contrib/file-loader) when `useRelativePath` is `true` and `context` is not setted (using `issuer.context`).\n\nTo run this repo, please clone this repo and run `npm install`, and then run `npm run build`.\n\nIf multi entries imported the same file (`./images/1.jpg` in this example), and if their issuer contexts are different (`./html/foo/` and `./html/` in this example), the compiled urls are wrong.\n\n\n### Src\n\n```\n|-- html\n|   |-- bar.html\n|   `-- foo\n|       `-- foo.html\n`-- images\n    `-- 1.jpg\n```\n\n\n### Build `foo.html` only\n\n```\n|-- foo.js\n|-- html\n|   `-- foo\n|       `-- foo.html\n`-- images\n    `-- 1.jpg\n```\n\n`./html/foo/foo.html` content is ✅\n\n```html\n\u003cimg src=\"../../images/1.jpg\" /\u003e\n```\n\n\n### Build `bar.html` only\n\n```\n|-- bar.js\n|-- html\n|   `-- bar.html\n`-- images\n    `-- 1.jpg\n```\n\n`./html/bar.html` content is ✅\n\n```html\n\u003cimg src=\"../images/1.jpg\" /\u003e\n```\n\n\n### Build both `foo.html` and `bar.html`\n\n```\n|-- bar.js\n|-- foo.js\n|-- html\n|   |-- bar.html\n|   `-- foo\n|       `-- foo.html\n`-- images\n    `-- 1.jpg\n```\n\n**Sometimes the results are:**\n\n`./html/foo/foo.html` content is ✅\n\n```html\n\u003cimg src=\"../../images/1.jpg\" /\u003e\n```\n\n`./html/bar.html` content is ❌\n\n```html\n\u003cimg src=\"../../images/1.jpg\" /\u003e\n```\n\n\n**And sometimes are:**\n\n`./html/foo/foo.html` content is ❌\n\n```html\n\u003cimg src=\"../images/1.jpg\" /\u003e\n```\n\n`./html/bar.html` content is ✅\n\n```html\n\u003cimg src=\"../images/1.jpg\" /\u003e\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap32%2Ffile-loader-relative-path-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcap32%2Ffile-loader-relative-path-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcap32%2Ffile-loader-relative-path-bug/lists"}