@rollup/plugin-urlIt should use the emitFile API to prevent watch to infinitely loop.
Actually, the plugin is using FS and is writing to the disk which causes the file watcher to trigger a rebuild.
I think it'll be great to update the doc to specify it's a bad practice (https://rollupjs.org/guide/en/#thisemitfileemittedfile-emittedchunk--emittedasset--string).
Ideally the plugin should be updated to the use the proper emitFile API, or change the plugin hook to writeBundle instead which makes more sense anyways than generateBundle.
PepsRyuu
We'd be happy to review a PR to resolve this.
It’s under investigation 😉
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ
@bastienrobert can we reopen this? I also believe this is an issue
@adamzerella The bot's message looks clear to me - this requires community resolution, and none was provided, so the issue was stale and closed. The same will happen to the new issue you opened if no one steps up to help resolve it.
I can see why this issue went stale. I was considering a PR, but this plugin does much more than just emit assets.
This plugin has a lot of customization options that make a conversion more complex: fileName, publicPath, sourceDir, and destDir. Some of these options might be better handled by another plugin or option: sourceDir is probably an alias. fileName and destDir are things that might be handled by assetFileNames, but would this be desirable? These would be breaking changes, and these are probably features people use.
It seems that the design of this plugin allows for a dest folder outside of the Rollup dest dir. It can be configured to break watch mode by outputting to a folder that Rollup is watching. Is this something we want to allow?
This plugin uses a node stream to copy the files. It's the most memory efficient way to do it, and to use the emitFile API would require the files to be loaded into memory. Probably not desirable.
All in all, I think a new plugin without the extra options would be better for the most common use cases. Maybe @rollup/plugin-url-assets?
Most helpful comment
It’s under investigation 😉