-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for compressor plugins #6776
Conversation
|
This does sound like a useful deployment optimization; avoiding uploading all of the non-compressed bundles could speed deploys significantly for large enough projects, right? |
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached Bundles
|
* v2: (69 commits) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) Fix add directoryExists function to matchFiles call. (#6784) Upgrade to Flow 158 (#6763) Revert "added cio headers (#6404)" (#6789) Process CSS in SVGs (#6743) ...
* v2: (38 commits) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) Fix add directoryExists function to matchFiles call. (#6784) Upgrade to Flow 158 (#6763) Revert "added cio headers (#6404)" (#6789) Process CSS in SVGs (#6743) ...
* bdo/number-edgetypes: (70 commits) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) Fix add directoryExists function to matchFiles call. (#6784) Upgrade to Flow 158 (#6763) Revert "added cio headers (#6404)" (#6789) Process CSS in SVGs (#6743) ...
* v2: (38 commits) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) Fix add directoryExists function to matchFiles call. (#6784) Upgrade to Flow 158 (#6763) Revert "added cio headers (#6404)" (#6789) Process CSS in SVGs (#6743) ...
* bdo/number-edgetypes: (70 commits) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) Fix add directoryExists function to matchFiles call. (#6784) Upgrade to Flow 158 (#6763) Revert "added cio headers (#6404)" (#6789) Process CSS in SVGs (#6743) ...
* v2: (42 commits) Remove dead link to docs in diagnostic (#6913) Fix engines.parcel in SVG packager (#6911) Use imported Readable flow type instead of global (#6910) Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) ...
* v2: (42 commits) Remove dead link to docs in diagnostic (#6913) Fix engines.parcel in SVG packager (#6911) Use imported Readable flow type instead of global (#6910) Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) ...
* bdo/number-edgetypes: (74 commits) Remove dead link to docs in diagnostic (#6913) Fix engines.parcel in SVG packager (#6911) Use imported Readable flow type instead of global (#6910) Use non-deprecated SVGO options in HTMLNanoOptimizer (#6785) Use yarnpkg registry for all the things (#6908) Fix issue about loading configs from tsconfig.json (#6881) Add `@section` to Compressor type (#6885) Parcel API improvements (#6866) Use stream-browserify for polyfilling instead (#6863) Add support for compressor plugins (#6776) Support for inline style attributes and inline scripts in SVG (#6797) Bump less (#6852) Make sure (non-React) SVGs are in separate bundles (#6757) Add support for injecting manifest into service workers (#6798) Fix 'does not export default' error with scope hoisting and url/worklet pipeline (#6803) Remaining cargo clippy fixes (#6829) Lazily install sharp only when needed (#6816) More cargo clippy suggestions (#6811) Don't emit runtime manifest for inline child bundles (#6807) Apply suggestions from rust-clippy (#6256) ...
@devongovett thanks for this, I need to try it now |
Closes #3731 #3732.
This adds a new plugin type: "compressors". These run after optimizers, while writing bundles to disk and create additional files next to the original bundles. They receive a stream, and return a new stream along with a file extension to add to the new file. Unlike optimizers, they do not affect the hash of the bundle. All files written by Parcel, including both bundles and source maps, are processed by compressors.
For example, a gzip compressor might create an additional file with the
.gz
extension. So far, I've written Gzip and Brotli compressor plugins.These aren't enabled by default because many servers handle compression automatically, so doing this at build time is unnecessary. But for static sites hosted on sites like S3, compression is required before uploading.
To enable it, add something like this to your
.parcelrc
:Tests to come. I'd like feedback on the API as well. In particular, one question: should it be possible to only output compressed bundles and not the original? i.e. should there be a
@parcel/compressor-raw
plugin that returns a passthrough stream that runs by default and you could disable it by not adding"..."
to"compressors"
in.parcelrc
?