@rollup/plugin-url does not use the asset mechanism
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- build-system, tooling
Research direction
Start by locating the @rollup/plugin-url implementation and tracing its current filesystem copying, asset URL generation, and destDir/publicPath handling. Compare that behavior with Rollup's emitFile, asset output, and resolveFileUrl APIs; done means the plugin uses the asset mechanism while documenting or testing the resulting breaking behavior. No file or test path is named in the issue.
Written by the indexing model from the issue text.
Description
- Rollup Plugin Name: @rollup/plugin-url
- Rollup Plugin Version: 8.0.2
Expected Behavior / Situation
The plugin mechanism offers an emitFile function meant for copying asset files to the output directory. By only referencing the files through their reference ID, the build system is able to keep track of dependencies. The list of produced asset files is also reflected in the output.
Actual Behavior / Situation
@rollup/plugin-url uses regular file system operations to manually copy the files over. This is bad because among other things, it means there is no method to retrieve a list of copied asset files. As this information seems to be part of the intended output of a Rollup build, I consider this a bug (but apparently I'm wrong).
Modification Proposal
Use the correct APIs. Especially since this is an official plugin, it should absolutely set a good example and use the officially provided API for file management. I'm even willing to provide a PR for it.
While this is relatively straightforward to fix, it has some implications on the API of this plugin. For example, the emission of assets can't be turned off by the plugin anymore, only in the output settings. I believe this is intended, but it is a breaking change.
Likewise the destDir parameter won't make sense anymore, since that is also determined by the build output (and that is definitely correct). This means that if the plugin was previously used for unintended purposes of dropping files outside of the output directory, that "functionality" would be broken.
The publicPath behavior may need to be rethought in light of the default file import URL handling of Rollup. My understanding is that import.meta.url is supposed to fill that role, which would again make the parameter obsolete. For now I've opted to just replicate the current output exactly by overriding resolveFileUrl.
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 635
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rollup/plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Support js-yaml v5 Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
Difficulty 1/5 Under an hour Newbie friendliness 90/100
matrix-org/matrix.org#3649 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·