Skip to content

Commit 17a68a9

Browse files
author
Nikolaos Veneti
committed
webpack gzip on gcloud with content-encoding headers
1 parent b9f2cd5 commit 17a68a9

File tree

3 files changed

+41
-36
lines changed

3 files changed

+41
-36
lines changed

.circleci/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ jobs:
4141
name: Copy analytics.min.js to CDN bucket with 5min cache
4242
command: |
4343
gsutil -h "Cache-Control:public,max-age=300" \
44-
cp dist/analytics.min.js gs://root-cdn/scripts/analytics/v1/dreamdata.min.js
44+
-h "Content-Type:text/javascript; charset=utf-8" \
45+
-h "Content-Encoding:gzip" \
46+
cp dist/analytics.min.js.gz gs://root-cdn/scripts/analytics/v1/dreamdata.min.js

package.json

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
{
2-
"name": "dreamdata-analytics",
3-
"author": "Segment.io <[email protected]>",
4-
"version": "2.12.0",
5-
"license": "MIT",
6-
"description": "The hassle-free way to integrate analytics into any web application.",
7-
"keywords": [
8-
"analytics",
9-
"analytics.js",
10-
"dreamdata",
11-
"dreamdata-analytics",
12-
"segment",
13-
"segment.io"
14-
],
15-
"repository": {
16-
"url": "https://github.com/segmentio/analytics.js.git",
17-
"type": "git"
18-
},
19-
"engines": {
20-
"node": ">=0.12.0"
21-
},
22-
"main": "analytics.js",
23-
"scripts": {
24-
"build:dev": "webpack --config webpack.dev.js",
25-
"build:prod": "webpack --config webpack.prod.js"
26-
},
27-
"presets": [
28-
"@babel/preset-env"
29-
],
30-
"devDependencies": {
31-
"webpack": "^4.41.2",
32-
"webpack-cli": "^3.3.9",
33-
"@babel/core": "^7.6.4",
34-
"@babel/preset-env": "^7.6.3",
35-
"babel-loader": "^8.0.6"
36-
}
2+
"name": "dreamdata-analytics",
3+
"author": "Segment.io <[email protected]>",
4+
"version": "2.12.0",
5+
"license": "MIT",
6+
"description": "The hassle-free way to integrate analytics into any web application.",
7+
"keywords": [
8+
"analytics",
9+
"analytics.js",
10+
"dreamdata",
11+
"dreamdata-analytics",
12+
"segment",
13+
"segment.io"
14+
],
15+
"repository": {
16+
"url": "https://github.com/segmentio/analytics.js.git",
17+
"type": "git"
18+
},
19+
"engines": {
20+
"node": ">=0.12.0"
21+
},
22+
"main": "analytics.js",
23+
"scripts": {
24+
"build:dev": "webpack --config webpack.dev.js",
25+
"build:prod": "webpack --config webpack.prod.js"
26+
},
27+
"presets": [
28+
"@babel/preset-env"
29+
],
30+
"devDependencies": {
31+
"webpack": "^4.41.2",
32+
"webpack-cli": "^3.3.9",
33+
"@babel/core": "^7.6.4",
34+
"@babel/preset-env": "^7.6.3",
35+
"babel-loader": "^8.0.6",
36+
"compression-webpack-plugin": "^3.0.0"
37+
}
3738
}

webpack.prod.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
const CompressionPlugin = require('compression-webpack-plugin');
23

34
module.exports = {
45
mode: 'production',
@@ -17,6 +18,7 @@ module.exports = {
1718
}
1819
]
1920
},
21+
plugins: [new CompressionPlugin()],
2022
output: {
2123
library: 'analytics',
2224
libraryTarget: 'umd',

0 commit comments

Comments
 (0)