{"id":24690026,"url":"https://github.com/kim366/rollup-plugin-base-url","last_synced_at":"2026-05-02T23:31:59.606Z","repository":{"id":52934387,"uuid":"347020195","full_name":"kim366/rollup-plugin-base-url","owner":"kim366","description":"Allows dynamic imports to be loaded from an absolute URL, such as `/`","archived":false,"fork":false,"pushed_at":"2021-04-13T09:19:58.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T00:34:36.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/kim366.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}},"created_at":"2021-03-12T10:02:00.000Z","updated_at":"2021-06-24T11:49:15.000Z","dependencies_parsed_at":"2022-08-25T03:12:27.692Z","dependency_job_id":null,"html_url":"https://github.com/kim366/rollup-plugin-base-url","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/kim366%2Frollup-plugin-base-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kim366%2Frollup-plugin-base-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kim366%2Frollup-plugin-base-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kim366%2Frollup-plugin-base-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kim366","download_url":"https://codeload.github.com/kim366/rollup-plugin-base-url/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244885700,"owners_count":20526296,"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":"2025-01-26T18:18:33.726Z","updated_at":"2025-10-26T19:36:32.766Z","avatar_url":"https://github.com/kim366.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-base-url\n\nAllows dynamic (and optionally static) imports to be loaded from an absolute URL, such as `/`.\n\n## Why?\n\nWhen you bundle an app with Rollup, dynamic `import()` calls are loaded as a relative path (starting with `./`). This is an issue if you have different routes, such as `/` and `/login` accessing the same chunk, since the latter will load `/login/your-chunk[hash].js`.\n\nThis plugin replaces dynamic import calls to have an absolute URL. By default this is `/` but it can be specified when, for example, your entire site is on another route, such as `/forum`.\n\n**Warning** This package does not construct an AST for performance \u0026 complexity reasons. Instead it does a naive copy/replace of `(./your-chunk[hash].js)` (where `[hash]` is the chunk's hash). This is not a string that should come up in your source code in unwanted places, so this should not be an issue. If it is, please file an issue. The benefit of this is that we get good compatibility with other plugins, such as [rollup-plugin-hoist-import-deps](https://github.com/vikerman/rollup-plugin-hoist-import-deps).\n\n## Installation\n```\nnpm i -D rollup-plugin-base-url\n```\n\n## Usage\n```js\nimport { baseUrl } from 'rollup-plugin-base-url';\n\nexport default {\n  input: 'index.js',\n  plugins: [\n    baseUrl({\n      url: '/forum', // the base URL prefix; optional, defaults to /\n      staticImports: true, // also rebases static `import _ from \"…\"`; optional, defaults to false\n    }),\n  ],\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkim366%2Frollup-plugin-base-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkim366%2Frollup-plugin-base-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkim366%2Frollup-plugin-base-url/lists"}