rollup / awesome

⚡️ Delightful Rollup Plugins, Packages, and Resources
MIT License
2.55k stars 139 forks source link

add: external-assets #81

Closed recursive-beast closed 3 years ago

recursive-beast commented 3 years ago

Awesome Contribution Checklist:

Please Provide a Link A Repository for Your Addition

https://github.com/soufyakoub/rollup-plugin-external-assets

Please Describe Your Addition

Imports to assets whose resolved id matches the provided pattern(s) are made external, but the assets themselves are emitted in the final output, and the imports are correctly updated to reference the target location of those assets.

This is useful for package creators. For example, a reusable react component that imports assets and the author wants to let the user choose how to bundle them.

smart-asset does the same thing with the "copy" mode, but from my experiments, since the provided assets target directory has to be relative to the output file, it only works as expected when the output is a single chunk.

external-assets however, since most of the work is actually done by rollup:

shellscape commented 3 years ago

If you just created something, wait at least 30 days before submitting

Please don't open a pull request until your project has met the guidelines, even if a draft.

recursive-beast commented 3 years ago

I'm very sorry, @shellscape . I have never used a pull request draft before, so I taught it was local to my GitHub account. I wanted to keep it saved so I don't forget about it until 30 days have passed.