-
Notifications
You must be signed in to change notification settings - Fork 12k
How to implement gzip in RC1 #5272
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
Comments
It is not possible to enable as part of Angular CLI itself. You can use something like gulp gzip to create a task that compresses your dist folder after build. |
Install a compression lib for your node server: yarn add compression Inside your node server server/index.js: const compression = require('compression');
const path = require('path');
const express = require('express');
const app = express();
const port = process.env.PORT || 8080;
// Gzip
app.use(compression());
// Run the app by serving the static files in the dist directory
app.use(express.static(__dirname + '/dist'));
// Start the app by listening on the default Heroku port
app.listen(port);
// For all GET requests, send back index.html so that PathLocationStrategy can be used
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname + '/dist/index.html'));
});
console.log(`Server listening on ${port}`); |
where do you serve your app? Most of the web servers support gzip compression per default like iis, apache ... |
I'm closing as the awesome CLI community has already added a bunch of great answers. Cheers! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
My application needs gzip since the bundle sizes upto 1.5MB. Event AOT doesn't reduce the size since the application uses the lazy loading.#3751
Is it possible to enable gzip for my application?
OS?
Versions.
Repro steps.
The log given by the failure.
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: