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.
rebase does the same thing too, but I checked its source, and it seems that it's using smart-asset under the hood.
external-assets however, since most of the work is actually done by rollup:
Supports multiple output chunks.
Supports filename patterns, like chunkFileNames, assetFileNames and entryFileNames.
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.rebase
does the same thing too, but I checked its source, and it seems that it's usingsmart-asset
under the hood.external-assets
however, since most of the work is actually done by rollup:chunkFileNames
,assetFileNames
andentryFileNames
.