update bundle configs
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
node_modules
|
||||
package-lock.json
|
||||
build
|
||||
dist
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"description": "record and replay the web",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"bundle": "rollup --config"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -20,6 +21,10 @@
|
||||
},
|
||||
"homepage": "https://github.com/rrweb-io/rrweb#readme",
|
||||
"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",
|
||||
"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;
|
||||
if (remaining <= 0 || remaining > wait) {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
window.clearTimeout(timeout);
|
||||
timeout = null;
|
||||
}
|
||||
previous = now;
|
||||
func.apply(context, args);
|
||||
} else if (!timeout && options.trailing !== false) {
|
||||
timeout = setTimeout(() => {
|
||||
timeout = window.setTimeout(() => {
|
||||
previous = options.leading === false ? 0 : Date.now();
|
||||
timeout = null;
|
||||
func.apply(context, args);
|
||||
|
||||
Reference in New Issue
Block a user