Skip to content

Commit 67977d4

Browse files
committed
chore(project): add terser
1 parent c99d137 commit 67977d4

File tree

4 files changed

+78
-8
lines changed

4 files changed

+78
-8
lines changed

package-lock.json

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"scripts": {
3434
"test": "CI=true react-scripts test --env=jsdom || true",
3535
"test:watch": "react-scripts test --env=jsdom",
36+
"prebuild": "rm -rf dist",
3637
"build": "rollup -c",
3738
"start": "rollup -c -w",
3839
"prepare": "npm run build",
@@ -70,6 +71,7 @@
7071
"rollup-plugin-commonjs": "^10.1.0",
7172
"rollup-plugin-node-resolve": "^5.2.0",
7273
"rollup-plugin-peer-deps-external": "^2.2.3",
74+
"rollup-plugin-terser": "^7.0.0",
7375
"rollup-plugin-typescript2": "^0.27.2",
7476
"standard-version": "^8.0.2",
7577
"typescript": "^3.9.7"

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import typescript from 'rollup-plugin-typescript2';
22
import commonjs from 'rollup-plugin-commonjs';
33
import external from 'rollup-plugin-peer-deps-external';
44
import resolve from 'rollup-plugin-node-resolve';
5+
import { terser } from 'rollup-plugin-terser';
56

67
import pkg from './package.json';
78

@@ -29,5 +30,6 @@ export default {
2930
clean: true,
3031
}),
3132
commonjs(),
33+
terser(),
3234
],
3335
};

src/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import * as React from 'react';
22

33
type TScriptLoader = {
4-
onCreate?: (() => null) | undefined;
5-
onLoad?: (() => null) | undefined;
6-
onError?: ((e: any) => never) | undefined;
7-
delayMs?: number | undefined;
8-
htmlPart?: string | undefined;
4+
onCreate?: () => null;
5+
onLoad?: () => null;
6+
onError?: (e: any) => never;
7+
delayMs?: number;
8+
htmlPart?: string;
99
src: string;
10-
otherProps?: Record<string, unknown> | undefined;
10+
otherProps?: Record<string, unknown>;
1111
};
1212

1313
type TAppendScript = {
1414
id: string;
1515
scriptText: string;
16-
optionalCallback?: (() => null) | undefined;
16+
optionalCallback?: () => null;
1717
htmlPart: string;
18-
otherProps?: Record<string, unknown> | undefined;
18+
otherProps?: Record<string, unknown>;
1919
};
2020

2121
type TUseScript = {

0 commit comments

Comments
 (0)