Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"description": "Extensibly serialize & deserialize Draft.js ContentState",
"main": "lib/index.js",
"module": "esm/index.js",
"browser": "dist/draft-convert.js",
"repository": "HubSpot/draft-convert",
"scripts": {
"build": "npm run build:cjs && npm run build:esm && npm run build:umd",
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
"build:esm": "cross-env BABEL_ENV=esm babel src --out-dir esm",
"build:umd": "wp",
"build:umd": "rollup -c",
"jest": "jest",
"jest:watch": "jest --watch",
"jest:debug": "node --debug-brk --inspect ./node_modules/.bin/jest -i",
Expand Down Expand Up @@ -66,8 +67,11 @@
"react": "^15.4.2",
"react-dom": "^15.4.2",
"rimraf": "2.5.4",
"webpack": "^4.35.3",
"webpack-nano": "^0.6.2"
"rollup": "1.18.0",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.1.1"
},
"jest": {
"testRegex": "/test/spec/.*\\.js$"
Expand Down
32 changes: 32 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import { terser } from 'rollup-plugin-terser';

const globals = {
'draft-js': 'Draft',
immutable: 'Immutable',
react: 'React',
'react-dom/server': 'ReactDOMServer',
};

const bundle = (env) => ({
input: 'esm/index.js',
external: Object.keys(globals),
output: {
globals,
file: env === 'production' ? 'dist/draft-convert.min.js' : 'dist/draft-convert.js' ,
format: 'umd',
name: 'DraftConvert',
},
plugins: [
nodeResolve(),
commonjs(),
replace({
'process.env.NODE_ENV': JSON.stringify(env)
}),
env === 'production' && terser(),
].filter(Boolean),
})

export default [bundle('production'), bundle('development')]
41 changes: 0 additions & 41 deletions webpack.config.js

This file was deleted.

Loading