Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit 4c1da9d

Browse files
committedFeb 23, 2020
Reduce extension file size
1 parent a7c35b7 commit 4c1da9d

File tree

7 files changed

+306
-30
lines changed

7 files changed

+306
-30
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ coverage
99

1010
*.vsix
1111
*.log
12+
assets/settings.schema.json

‎.vscode/tasks.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"label": "Watch",
66
"type": "shell",
7-
"command": "rm -rf /tmp/vscode-syncify && mkdir -p /tmp/vscode-syncify/{extensions,user-data} && yarn watch",
7+
"command": "rm -rf /tmp/vscode-syncify && mkdir -p /tmp/vscode-syncify/{extensions,user-data} && yarn start",
88
"group": {
99
"kind": "build",
1010
"isDefault": true

‎.webpack/common.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { resolve } from "path";
22
import { TsConfigPathsPlugin } from "awesome-typescript-loader";
33
import { Configuration } from "webpack";
4+
import { CleanWebpackPlugin } from "clean-webpack-plugin";
45

56
const config: Configuration = {
67
stats: {
@@ -32,6 +33,7 @@ const config: Configuration = {
3233
}
3334
]
3435
},
36+
plugins: [new CleanWebpackPlugin()],
3537
externals: {
3638
vscode: "commonjs vscode",
3739
"vscode-fsevents": "commonjs vscode-fsevents"

‎.webpack/development.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import common from "./common";
2-
import merge from "lodash/merge";
3-
import { Configuration } from "webpack";
2+
import merge from "webpack-merge";
3+
import webpack from "webpack";
44

5-
const config = merge<Configuration, Configuration>(common, {
5+
const config = merge(common, {
66
mode: "development",
7-
devtool: "source-map"
7+
devtool: "source-map",
8+
plugins: [
9+
new webpack.SourceMapDevToolPlugin({
10+
filename: null,
11+
exclude: /node_modules/,
12+
test: /\.ts($|\?)/i
13+
})
14+
]
815
});
916

1017
export default config;

‎.webpack/production.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
import common from "./common";
2-
import merge from "lodash/merge";
3-
import { Configuration } from "webpack";
2+
import merge from "webpack-merge";
3+
import TerserPlugin from "terser-webpack-plugin";
44

5-
const config = merge<Configuration, Configuration>(common, {
6-
mode: "development",
5+
const config = merge(common, {
6+
mode: "production",
77
optimization: {
8-
minimize: true
8+
minimizer: [
9+
new TerserPlugin({
10+
cache: false,
11+
sourceMap: true,
12+
extractComments: true,
13+
terserOptions: {
14+
ecma: 2017,
15+
mangle: false,
16+
keep_classnames: true,
17+
keep_fnames: true
18+
}
19+
})
20+
]
921
}
1022
});
1123

‎package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@
77
"version": "3.14.0",
88
"main": "./dist/main.js",
99
"scripts": {
10-
"start": "run watch",
11-
"build": "run clean && webpack --config .webpack/production.ts",
12-
"watch": "run clean && webpack --config .webpack/development.ts --watch",
10+
"start": "webpack --config .webpack/development.ts --watch",
11+
"build": "webpack --config .webpack/production.ts",
1312
"test": "jest",
1413
"schema": "typescript-json-schema tsconfig.json ISettings -o assets/settings.schema.json --noExtraProps",
15-
"clean": "shx rm -rf dist",
16-
"vscode:prepublish": "run schema && run build"
14+
"vscode:prepublish": "yarn schema && yarn build"
1715
},
1816
"dependencies": {
17+
"@types/terser-webpack-plugin": "^2.2.0",
1918
"axios": "^0.19.2",
19+
"clean-webpack-plugin": "^3.0.0",
2020
"compare-versions": "^3.6.0",
2121
"express": "^4.17.1",
2222
"fast-glob": "^3.1.1",
2323
"fs-extra": "^8.1.0",
2424
"jsonc-parser": "^2.2.0",
2525
"lodash": "^4.17.15",
2626
"simple-git": "^1.131.0",
27+
"terser-webpack-plugin": "^2.3.5",
2728
"vscode-chokidar": "^2.1.7"
2829
},
2930
"devDependencies": {
@@ -34,13 +35,13 @@
3435
"@types/node": "^13.7.4",
3536
"@types/vscode": "1.41.0",
3637
"@types/webpack": "^4.41.6",
38+
"@types/webpack-merge": "^4.1.5",
3739
"all-contributors-cli": "^6.13.0",
3840
"awesome-typescript-loader": "^5.2.1",
3941
"codecov": "^3.6.5",
4042
"jest": "^25.1.0",
4143
"jest-raw-loader": "^1.0.1",
4244
"raw-loader": "^4.0.0",
43-
"run-script-proxy": "^1.0.1",
4445
"shx": "^0.3.2",
4546
"ts-jest": "^25.2.1",
4647
"ts-loader": "^6.2.1",
@@ -53,7 +54,8 @@
5354
"utility-types": "^3.10.0",
5455
"vsce": "^1.73.0",
5556
"webpack": "^4.41.6",
56-
"webpack-cli": "^3.3.11"
57+
"webpack-cli": "^3.3.11",
58+
"webpack-merge": "^4.2.2"
5759
},
5860
"engines": {
5961
"vscode": "^1.41.0"

‎yarn.lock

+265-13
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
This repository has been archived.