Skip to content

Commit 9a30bef

Browse files
committed
chore(overmind): create a prod build and add bundlesize to keep an eye on the size
1 parent 0c57f48 commit 9a30bef

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@
114114
"vscode": "1.1.34",
115115
"vue": "2.5.16",
116116
"vue-template-compiler": "2.5.16",
117-
"webpack": "4.28.4",
117+
"webpack": "4.35.0",
118118
"webpack-cli": "3.1.2",
119119
"webpack-dev-server": "3.1.11",
120-
"webpack-merge": "4.2.1"
120+
"webpack-merge": "4.2.1",
121+
"bundlesize": "0.17.2"
121122
},
122123
"lint-staged": {
123124
"*.{js,ts,tsx}": [

packages/node_modules/overmind/package.json

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
"module": "es/index.js",
1010
"types": "lib/index.d.ts",
1111
"scripts": {
12-
"build": "npm run build:lib & npm run build:es",
12+
"build": "(npm run build:lib & npm run build:es) && npm run build:dist",
1313
"build:lib": "tsc --outDir lib --module commonjs",
1414
"build:es": "tsc --outDir es --module es2015",
15+
"build:dist": "webpack --config webpack.config.js",
1516
"clean": "rimraf es lib coverage",
1617
"typecheck": "tsc --noEmit",
17-
"test": "jest --runInBand",
18+
"test": "jest --runInBand && npm run test:size",
1819
"test:watch": "jest --watch --updateSnapshot --coverage false",
20+
"test:size": "bundlesize",
1921
"prebuild": "npm run clean",
2022
"postbuild": "rimraf {lib,es}/**/__tests__",
2123
"posttest": "npm run typecheck"
@@ -38,6 +40,15 @@
3840
},
3941
"devDependencies": {
4042
"@types/node": "^10.12.21",
41-
"tslib": "^1.9.3"
42-
}
43+
"bundlesize": "^0.17.2",
44+
"terser-webpack-plugin": "^1.3.0",
45+
"tslib": "^1.9.3",
46+
"webpack": "^4.35.0"
47+
},
48+
"bundlesize": [
49+
{
50+
"path": "./dist/overmind.min.js",
51+
"maxSize": "10 kB"
52+
}
53+
]
4354
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const path = require('path')
2+
const TerserPlugin = require('terser-webpack-plugin')
3+
4+
module.exports = {
5+
mode: 'production',
6+
entry: path.resolve('./es/index.js'),
7+
output: {
8+
path: path.resolve('dist'),
9+
filename: 'overmind.min.js',
10+
},
11+
optimization: {
12+
minimizer: [
13+
new TerserPlugin({
14+
test: /\.js(\?.*)?$/i,
15+
parallel: true,
16+
sourceMap: true,
17+
terserOptions: {
18+
module: true,
19+
},
20+
}),
21+
],
22+
},
23+
module: {
24+
rules: [
25+
{
26+
test: /\.js$/,
27+
loader: 'babel-loader',
28+
include: path.resolve('src'),
29+
options: {
30+
presets: ['@babel/preset-env'],
31+
},
32+
},
33+
],
34+
},
35+
}

0 commit comments

Comments
 (0)