update bundle config
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,5 +3,7 @@ node_modules
|
||||
package-lock.json
|
||||
build
|
||||
dist
|
||||
es
|
||||
lib
|
||||
|
||||
temp
|
||||
|
||||
12
package.json
12
package.json
@@ -2,8 +2,6 @@
|
||||
"name": "rrweb",
|
||||
"version": "0.6.0",
|
||||
"description": "record and replay the web",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/module.js",
|
||||
"scripts": {
|
||||
"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",
|
||||
@@ -16,8 +14,14 @@
|
||||
"keywords": [
|
||||
"rrweb"
|
||||
],
|
||||
"main": "lib/rrweb.js",
|
||||
"module": "es/rrweb.js",
|
||||
"unpkg": "dist/rrweb.js",
|
||||
"typings": "./index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"lib",
|
||||
"es",
|
||||
"index.d.ts",
|
||||
"src/types.ts"
|
||||
],
|
||||
@@ -37,9 +41,9 @@
|
||||
"jest-snapshot": "^23.6.0",
|
||||
"mocha": "^5.2.0",
|
||||
"puppeteer": "^1.9.0",
|
||||
"rewire": "^4.0.1",
|
||||
"rollup": "^0.66.6",
|
||||
"rollup-plugin-node-resolve": "^3.4.0",
|
||||
"rollup-plugin-terser": "^3.0.0",
|
||||
"rollup-plugin-typescript": "^1.0.0",
|
||||
"ts-node": "^7.0.1",
|
||||
"tslib": "^1.9.3",
|
||||
@@ -48,6 +52,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"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 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 [
|
||||
// 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',
|
||||
plugins: [typescript(), resolve()],
|
||||
output: [
|
||||
{
|
||||
format: 'cjs',
|
||||
file: './dist/record/index.js',
|
||||
},
|
||||
{
|
||||
format: 'esm',
|
||||
file: './dist/record/module.js',
|
||||
},
|
||||
{
|
||||
name: 'record',
|
||||
format: 'iife',
|
||||
file: './dist/record/browser.js',
|
||||
file: toRecordPath(pkg.main),
|
||||
},
|
||||
],
|
||||
},
|
||||
// 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',
|
||||
plugins: [typescript(), resolve()],
|
||||
output: [
|
||||
{
|
||||
format: 'cjs',
|
||||
file: './dist/index.js',
|
||||
file: pkg.main,
|
||||
},
|
||||
],
|
||||
},
|
||||
// ES module
|
||||
{
|
||||
input: './src/index.ts',
|
||||
plugins: [typescript(), resolve()],
|
||||
output: [
|
||||
{
|
||||
format: 'esm',
|
||||
file: './dist/module.js',
|
||||
file: pkg.module,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
input: './src/index.ts',
|
||||
plugins: [typescript(), resolve(), terser()],
|
||||
output: [
|
||||
{
|
||||
name: 'rrweb',
|
||||
format: 'iife',
|
||||
file: './dist/browser.js',
|
||||
format: 'esm',
|
||||
file: toMinPath(pkg.module),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user