Skip to content

Commit 98d0d7c

Browse files
committed
feat: Added rollup bundling
1 parent 5db509c commit 98d0d7c

File tree

4 files changed

+310
-12
lines changed

4 files changed

+310
-12
lines changed

Diff for: package.json

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "webrtc-issue-detector",
33
"version": "1.0.8",
44
"description": "WebRTC diagnostic tool that detects issues with network or user devices",
5-
"main": "dist/index.js",
5+
"main": "dist/bundle-cjs.js",
6+
"module": "dist/bundle-esm.js",
67
"types": "dist/index.d.ts",
7-
"typings": "dist/index",
88
"repository": "[email protected]:VLprojects/webrtc-issue-detector.git",
99
"author": "Roman Kuzakov <[email protected]>",
1010
"license": "MIT",
@@ -17,11 +17,12 @@
1717
"dist/"
1818
],
1919
"scripts": {
20-
"build": "tsc",
20+
"build": "rm -rf dist && rollup -c",
2121
"lint": "eslint ./src",
2222
"test": "NODE_ENV=test mocha --config test/utils/runners/mocha/.mocharc.js"
2323
},
2424
"devDependencies": {
25+
"@rollup/plugin-typescript": "^8.3.4",
2526
"@types/chai": "^4.3.3",
2627
"@types/chai-as-promised": "^7.1.5",
2728
"@types/chai-subset": "^1.3.3",
@@ -42,6 +43,10 @@
4243
"eslint-plugin-jsx-a11y": "^6.6.1",
4344
"faker": "^5.5.3",
4445
"mocha": "^10.0.0",
46+
"rollup": "^2.78.0",
47+
"rollup-plugin-bundle-size": "^1.0.3",
48+
"rollup-plugin-polyfill-node": "^0.10.2",
49+
"rollup-plugin-terser": "^7.0.2",
4550
"sinon": "^14.0.0",
4651
"sinon-chai": "^3.7.0",
4752
"ts-node": "^10.9.1",

Diff for: rollup.config.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import typescript from '@rollup/plugin-typescript';
2+
import { terser } from 'rollup-plugin-terser';
3+
import nodePolyfills from 'rollup-plugin-polyfill-node';
4+
import bundleSize from 'rollup-plugin-bundle-size';
5+
6+
export default {
7+
input: 'src/index.ts',
8+
output: [
9+
{
10+
file: './dist/bundle-esm.js',
11+
format: 'es',
12+
},
13+
{
14+
file: './dist/bundle-cjs.js',
15+
format: 'cjs',
16+
exports: 'named',
17+
},
18+
],
19+
plugins: [
20+
nodePolyfills({ include: ['events'] }),
21+
typescript(),
22+
terser(),
23+
bundleSize(),
24+
],
25+
};

Diff for: tsconfig.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"module": "commonjs",
4-
"target": "es6",
3+
"module": "esnext",
4+
"target": "esnext",
55
"lib": [
66
"dom",
77
"dom.iterable",
@@ -16,5 +16,5 @@
1616
"include": [
1717
"src/index.ts",
1818
"src/**/*"
19-
]
19+
, "rollup.config.js" ]
2020
}

0 commit comments

Comments
 (0)