update bundle config
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -3,3 +3,5 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
build
|
build
|
||||||
dist
|
dist
|
||||||
|
es
|
||||||
|
lib
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
"name": "rrweb-snapshot",
|
"name": "rrweb-snapshot",
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer",
|
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer",
|
||||||
"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/**/*.ts",
|
"test": "TS_NODE_CACHE=false TS_NODE_FILES=true mocha -r ts-node/register test/**/*.ts",
|
||||||
"bundle": "rollup --config"
|
"bundle": "rollup --config"
|
||||||
@@ -17,8 +15,14 @@
|
|||||||
"snapshot",
|
"snapshot",
|
||||||
"DOM"
|
"DOM"
|
||||||
],
|
],
|
||||||
|
"main": "lib/rrweb-snapshot.js",
|
||||||
|
"module": "es/rrweb-snapshot.js",
|
||||||
|
"unpkg": "dist/rrweb-snapshot.js",
|
||||||
|
"typings": "./index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
|
"lib",
|
||||||
|
"es",
|
||||||
"index.d.ts",
|
"index.d.ts",
|
||||||
"src/types.ts"
|
"src/types.ts"
|
||||||
],
|
],
|
||||||
@@ -38,6 +42,7 @@
|
|||||||
"mocha": "^5.2.0",
|
"mocha": "^5.2.0",
|
||||||
"puppeteer": "^1.9.0",
|
"puppeteer": "^1.9.0",
|
||||||
"rollup": "^0.66.4",
|
"rollup": "^0.66.4",
|
||||||
|
"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",
|
||||||
|
|||||||
@@ -1,21 +1,65 @@
|
|||||||
import typescript from 'rollup-plugin-typescript';
|
import typescript from 'rollup-plugin-typescript';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
export default {
|
function toMinPath(path) {
|
||||||
input: './src/index.ts',
|
return path.replace(/\.js$/, '.min.js');
|
||||||
plugins: [typescript()],
|
}
|
||||||
output: [
|
|
||||||
{
|
export default [
|
||||||
format: 'cjs',
|
// browser
|
||||||
file: './dist/index.js',
|
{
|
||||||
},
|
input: './src/index.ts',
|
||||||
{
|
plugins: [typescript()],
|
||||||
format: 'esm',
|
output: [
|
||||||
file: './dist/module.js',
|
{
|
||||||
},
|
name: 'rrwebSnapshot',
|
||||||
{
|
format: 'umd',
|
||||||
name: 'rrwebSnapshot',
|
file: pkg.unpkg,
|
||||||
format: 'iife',
|
},
|
||||||
file: './dist/browser.js',
|
],
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
};
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), terser()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
name: 'rrwebSnapshot',
|
||||||
|
format: 'umd',
|
||||||
|
file: toMinPath(pkg.unpkg),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// CommonJS
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'cjs',
|
||||||
|
file: pkg.main,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// ES module
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'esm',
|
||||||
|
file: pkg.module,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
input: './src/index.ts',
|
||||||
|
plugins: [typescript(), terser()],
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
format: 'esm',
|
||||||
|
file: toMinPath(pkg.module),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user