Skip to content

Commit 0ff44f5

Browse files
committed
fix(jsany): #1 Cannot read property 'hasOwnProperty' of undefined
1 parent 104b4c7 commit 0ff44f5

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ module.exports = {
2424
'no-param-reassign': 1,
2525
'@typescript-eslint/no-invalid-this': 1,
2626
'@typescript-eslint/no-require-imports': 1,
27+
'@typescript-eslint/consistent-type-assertions': 1,
2728
}
2829
};

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ In `webpack.config.js`:
4141
const LogFilesizeWebpackPlugin = require('@jsany/log-filesize-webpack-plugin');
4242

4343
module.exports = {
44+
45+
stats: 'errors-only', // to close webpack print
4446
// ...
4547
plugins: [
4648
new LogFilesizeWebpackPlugin()
4749
// or
48-
// new LogFilesizeWebpackPlugin({gzip: true,...Options})
50+
// new LogFilesizeWebpackPlugin({gzip: true,...OtherOptions})
4951
]
5052
// ...
5153
}

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
"sort-package-json"
5454
]
5555
},
56+
"dependencies": {
57+
"chalk": "^4.1.0",
58+
"clean-webpack-plugin": "^3.0.0",
59+
"cliui": "^6.0.0",
60+
"webpack": "^4.43.0",
61+
"webpack-cli": "^3.3.12"
62+
},
5663
"devDependencies": {
5764
"@babel/core": "^7.10.5",
5865
"@babel/plugin-proposal-class-properties": "^7.10.4",
@@ -68,9 +75,6 @@
6875
"@typescript-eslint/eslint-plugin": "^3.6.1",
6976
"@typescript-eslint/parser": "^3.6.1",
7077
"babel-loader": "^8.1.0",
71-
"chalk": "^4.1.0",
72-
"clean-webpack-plugin": "^3.0.0",
73-
"cliui": "^6.0.0",
7478
"cross-env": "^7.0.2",
7579
"eslint": "^7.4.0",
7680
"eslint-config-alloy": "^3.7.3",
@@ -82,9 +86,7 @@
8286
"standard-version": "^8.0.2",
8387
"ttypescript": "^1.5.10",
8488
"typescript": "^3.9.6",
85-
"typescript-transform-paths": "^1.1.14",
86-
"webpack": "^4.43.0",
87-
"webpack-cli": "^3.3.12"
89+
"typescript-transform-paths": "^1.1.14"
8890
},
8991
"engines": {
9092
"node": ">=8.10.0"

src/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const makeRow = (a: string, b: string, c: string): string => {
6565
class LogFilesizeWebpackPlugin {
6666
private options: IOptions;
6767

68-
public constructor(options: IOptions) {
68+
public constructor(options = {} as IOptions) {
6969
this.options = this.mergeOptions(options, defaultOptions);
7070
}
7171
public apply = (compiler: Compiler) => {
@@ -120,22 +120,24 @@ class LogFilesizeWebpackPlugin {
120120
});
121121

122122
if (this.options.errors && json.errors.length) {
123-
ui.div(chalk.red('Error: ') + '\n' + json.errors.join('\n'));
123+
ui.div(chalk.red.bold('Error: ') + '\n' + json.errors.join('\n'));
124+
ui.div('\n');
124125
}
125126
if (this.options.warnings && json.warnings.length) {
126-
ui.div(chalk.yellow('Warning: ') + '\n' + json.warnings.join('\n'));
127+
ui.div(chalk.yellow.bold('Warning: ') + '\n' + json.warnings.join('\n'));
128+
ui.div('\n');
127129
}
128130
if (this.options.version) {
129-
ui.div(chalk.white('Version: webpack ') + json.version);
131+
ui.div(chalk.white.bold('Version: ') + 'webpack ' + json.version);
130132
}
131133
if (this.options.hash) {
132-
ui.div(chalk.white('Hash: ') + json.hash);
134+
ui.div(chalk.white.bold('Hash: ') + json.hash);
133135
}
134136
if (this.options.time) {
135-
ui.div(chalk.white('Time: ') + json.time + 'ms');
137+
ui.div(chalk.white.bold('Time: ') + json.time + 'ms');
136138
}
137139
if (this.options.builtAt) {
138-
ui.div(chalk.white('Built At: ') + new Date(json.builtAt!));
140+
ui.div(chalk.white.bold('Built At: ') + new Date(json.builtAt!));
139141
}
140142
ui.div('\n');
141143
ui.div(

0 commit comments

Comments
 (0)