update bundle config
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,7 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
|
es
|
||||||
|
lib
|
||||||
|
|
||||||
temp
|
temp
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -2,8 +2,6 @@
|
|||||||
"name": "rrweb",
|
"name": "rrweb",
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"description": "record and replay the web",
|
"description": "record and replay the web",
|
||||||
"main": "dist/index.js",
|
|
||||||
"module": "dist/module.js",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts",
|
"test": "TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.test.ts",
|
||||||
"repl": "TS_NODE_CACHE=false TS_NODE_FILES=true ts-node test/repl.ts",
|
"repl": "TS_NODE_CACHE=false TS_NODE_FILES=true ts-node test/repl.ts",
|
||||||
@@ -16,8 +14,14 @@
|
|||||||
"keywords": [
|
"keywords": [
|
||||||
"rrweb"
|
"rrweb"
|
||||||
],
|
],
|
||||||
|
"main": "lib/rrweb.js",
|
||||||
|
"module": "es/rrweb.js",
|
||||||
|
"unpkg": "dist/rrweb.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
"lib",
|
||||||
|
"es",
|
||||||
"index.d.ts",
|
"index.d.ts",
|
||||||
"src/types.ts"
|
"src/types.ts"
|
||||||
],
|
],
|
||||||
@@ -37,9 +41,9 @@
|
|||||||
"jest-snapshot": "^23.6.0",
|
"jest-snapshot": "^23.6.0",
|
||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"puppeteer": "^1.9.0",
|
"puppeteer": "^1.9.0",
|
||||||
"rewire": "^4.0.1",
|
|
||||||
"rollup": "^0.66.6",
|
"rollup": "^0.66.6",
|
||||||
"rollup-plugin-node-resolve": "^3.4.0",
|
"rollup-plugin-node-resolve": "^3.4.0",
|
||||||
|
"rollup-plugin-terser": "^3.0.0",
|
||||||
"rollup-plugin-typescript": "^1.0.0",
|
"rollup-plugin-typescript": "^1.0.0",
|
||||||
"ts-node": "^7.0.1",
|
"ts-node": "^7.0.1",
|
||||||
"tslib": "^1.9.3",
|
"tslib": "^1.9.3",
|
||||||
@@ -48,6 +52,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"mitt": "^1.1.3",
|
"mitt": "^1.1.3",
|
||||||
"rrweb-snapshot": "^0.6.0"
|
"rrweb-snapshot": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
114
rollup.config.js
114
rollup.config.js
@@ -1,42 +1,126 @@
|
|||||||
import typescript from 'rollup-plugin-typescript';
|
import typescript from 'rollup-plugin-typescript';
|
||||||
import resolve from 'rollup-plugin-node-resolve';
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
|
function toRecordPath(path) {
|
||||||
|
return path
|
||||||
|
.replace(/^([\w]+)\//, '$1/record/')
|
||||||
|
.replace('rrweb', 'rrweb-record');
|
||||||
|
}
|
||||||
|
|
||||||
|
function toMinPath(path) {
|
||||||
|
return path.replace(/\.js$/, '.min.js');
|
||||||
|
}
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
// browser(record only)
|
||||||
|
{
|
||||||
|
input: './src/record/index.ts',
|
||||||
|
plugins: [typescript(), resolve()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'record',
|
||||||
|
format: 'umd',
|
||||||
|
file: toRecordPath(pkg.unpkg),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: './src/record/index.ts',
|
||||||
|
plugins: [typescript(), resolve(), terser()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'record',
|
||||||
|
format: 'umd',
|
||||||
|
file: toMinPath(toRecordPath(pkg.unpkg)),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// CommonJS(record only)
|
||||||
{
|
{
|
||||||
input: './src/record/index.ts',
|
input: './src/record/index.ts',
|
||||||
plugins: [typescript(), resolve()],
|
plugins: [typescript(), resolve()],
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
file: './dist/record/index.js',
|
file: toRecordPath(pkg.main),
|
||||||
},
|
|
||||||
{
|
|
||||||
format: 'esm',
|
|
||||||
file: './dist/record/module.js',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'record',
|
|
||||||
format: 'iife',
|
|
||||||
file: './dist/record/browser.js',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
// ES module(record only)
|
||||||
|
{
|
||||||
|
input: './src/record/index.ts',
|
||||||
|
plugins: [typescript(), resolve()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'esm',
|
||||||
|
file: toRecordPath(pkg.module),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: './src/record/index.ts',
|
||||||
|
plugins: [typescript(), resolve(), terser()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'esm',
|
||||||
|
file: toMinPath(toRecordPath(pkg.module)),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// browser
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), resolve()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'rrweb',
|
||||||
|
format: 'umd',
|
||||||
|
file: pkg.unpkg,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), resolve(), terser()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'rrweb',
|
||||||
|
format: 'umd',
|
||||||
|
file: toMinPath(pkg.unpkg),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// CommonJS
|
||||||
{
|
{
|
||||||
input: './src/index.ts',
|
input: './src/index.ts',
|
||||||
plugins: [typescript(), resolve()],
|
plugins: [typescript(), resolve()],
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
file: './dist/index.js',
|
file: pkg.main,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// ES module
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), resolve()],
|
||||||
|
output: [
|
||||||
{
|
{
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
file: './dist/module.js',
|
file: pkg.module,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), resolve(), terser()],
|
||||||
|
output: [
|
||||||
{
|
{
|
||||||
name: 'rrweb',
|
format: 'esm',
|
||||||
format: 'iife',
|
file: toMinPath(pkg.module),
|
||||||
file: './dist/browser.js',
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user