Multiple extension support (e.g tar.gz)
Resolve asset with full extension
Resolve asset with part of extension (e.g .gz)
Split extension from the first dot.
https://github.com/parcel-bundler/parcel/blob/24f28bc5d7dd4324841209379d2823654ab9c8e7/src/Parser.js#L69
Create plugin with multiple dots extensions, or just load tar.gz file.
import download from './compress.tar.gz';
I found a regex which might be helping: https://regex101.com/r/nQ4oW8/1
/(?:\.ext[1-4])+$/i
found here: https://stackoverflow.com/a/21607977/3793309
This requires a set of predefined extensions, but it's the most straightforward approach I could think of right now.
I wouldn't split after first dot, since this could bring new issues, e.g. a plugin which has files like myPlugin.v1.1.js or like your example: import download from './compress.tar.gz'; <= .tar.gz
The actual extracting of the extension will be fairly hard as a filename is allowed to contain dots that are not part of any extension, I propose the following:
Regex out extensions
=> Search known extensions
=> Match? => Use specified Asset
=> No Match? => Use last extension
=> Match? => Use specified Asset
=> No Match? => Fallback to RawAsset
Going to close this since it is solved in Parcel 2 where plugins are matched using globs. You could use something like *.tar.gz
Most helpful comment
Going to close this since it is solved in Parcel 2 where plugins are matched using globs. You could use something like
*.tar.gz