update bundle configs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
build
|
build
|
||||||
|
dist
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
"description": "record and replay the web",
|
"description": "record and replay the web",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"bundle": "rollup --config"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -20,6 +21,10 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/rrweb-io/rrweb#readme",
|
"homepage": "https://github.com/rrweb-io/rrweb#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"rollup": "^0.66.6",
|
||||||
|
"rollup-plugin-node-resolve": "^3.4.0",
|
||||||
|
"rollup-plugin-typescript": "^1.0.0",
|
||||||
|
"tslib": "^1.9.3",
|
||||||
"tslint": "^4.5.1",
|
"tslint": "^4.5.1",
|
||||||
"typescript": "^3.1.1"
|
"typescript": "^3.1.1"
|
||||||
},
|
},
|
||||||
|
|||||||
22
rollup.config.js
Normal file
22
rollup.config.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import typescript from 'rollup-plugin-typescript';
|
||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), resolve()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'cjs',
|
||||||
|
file: './dist/index.js',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
format: 'esm',
|
||||||
|
file: './dist/module.js',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'rrweb',
|
||||||
|
format: 'iife',
|
||||||
|
file: './dist/browser.js',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -48,13 +48,13 @@ export function throttle<T>(
|
|||||||
let args = arguments;
|
let args = arguments;
|
||||||
if (remaining <= 0 || remaining > wait) {
|
if (remaining <= 0 || remaining > wait) {
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(timeout);
|
window.clearTimeout(timeout);
|
||||||
timeout = null;
|
timeout = null;
|
||||||
}
|
}
|
||||||
previous = now;
|
previous = now;
|
||||||
func.apply(context, args);
|
func.apply(context, args);
|
||||||
} else if (!timeout && options.trailing !== false) {
|
} else if (!timeout && options.trailing !== false) {
|
||||||
timeout = setTimeout(() => {
|
timeout = window.setTimeout(() => {
|
||||||
previous = options.leading === false ? 0 : Date.now();
|
previous = options.leading === false ? 0 : Date.now();
|
||||||
timeout = null;
|
timeout = null;
|
||||||
func.apply(context, args);
|
func.apply(context, args);
|
||||||
|
|||||||
Reference in New Issue
Block a user