Skip to content

Commit 040af1b

Browse files
committed
Fixed bundling ReactDOM
1 parent 3f21321 commit 040af1b

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

package.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
{
22
"name": "react-final-form-html5-validation",
33
"version": "1.0.0",
4-
"description":
5-
"A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation",
4+
"description": "A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation",
65
"main": "dist/react-final-form-html5-validation.cjs.js",
76
"jsnext:main": "dist/react-final-form-html5-validation.es.js",
87
"module": "dist/react-final-form-html5-validation.es.js",
98
"sideEffects": false,
10-
"files": ["dist"],
9+
"files": [
10+
"dist"
11+
],
1112
"scripts": {
1213
"start": "nps",
1314
"test": "nps test",
1415
"precommit": "lint-staged && npm start validate"
1516
},
16-
"author":
17-
"Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)",
17+
"author": "Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)",
1818
"license": "MIT",
1919
"repository": {
2020
"type": "git",
2121
"url": "https://github.com/final-form/react-final-form-html5-validation.git"
2222
},
2323
"bugs": {
24-
"url":
25-
"https://github.com/final-form/react-final-form-html5-validation/issues"
24+
"url": "https://github.com/final-form/react-final-form-html5-validation/issues"
2625
},
27-
"homepage":
28-
"https://github.com/final-form/react-final-form-html5-validation#readme",
26+
"homepage": "https://github.com/final-form/react-final-form-html5-validation#readme",
2927
"devDependencies": {
3028
"babel-eslint": "^8.2.2",
3129
"babel-jest": "^22.4.1",
@@ -71,13 +69,19 @@
7169
"final-form": ">=4.0.0",
7270
"prop-types": "^15.6.0",
7371
"react": "^15.3.0 || ^16.0.0-0",
72+
"react-dom": "^15.3.0 || ^16.0.0-0",
7473
"react-final-form": ">=3.0.0"
7574
},
7675
"jest": {
77-
"setupFiles": ["raf/polyfill"]
76+
"setupFiles": [
77+
"raf/polyfill"
78+
]
7879
},
7980
"lint-staged": {
80-
"*.{js*,ts*,json,md,css}": ["prettier --write", "git add"]
81+
"*.{js*,ts*,json,md,css}": [
82+
"prettier --write",
83+
"git add"
84+
]
8185
},
8286
"bundlesize": [
8387
{

rollup.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import flow from 'rollup-plugin-flow'
44
import commonjs from 'rollup-plugin-commonjs'
55
import uglify from 'rollup-plugin-uglify'
66
import replace from 'rollup-plugin-replace'
7+
import pkg from './package.json'
78

89
const minify = process.env.MINIFY
910
const format = process.env.FORMAT
@@ -41,6 +42,9 @@ if (es) {
4142
throw new Error('no format specified. --environment FORMAT:xxx')
4243
}
4344

45+
const deps = Object.keys(pkg.dependencies || {})
46+
const peers = Object.keys(pkg.peerDependencies || {})
47+
4448
export default {
4549
input: 'src/index.js',
4650
output: Object.assign(
@@ -49,18 +53,19 @@ export default {
4953
exports: 'named',
5054
globals: {
5155
react: 'React',
56+
'react-dom': 'ReactDOM',
5257
'prop-types': 'PropTypes',
5358
'final-form': 'FinalForm',
5459
'react-final-form': 'ReactFinalForm'
5560
}
5661
},
5762
output
5863
),
59-
external: ['react', 'prop-types', 'final-form', 'react-final-form'],
64+
external: umd ? peers : deps.concat(peers),
6065
plugins: [
6166
resolve({ jsnext: true, main: true }),
6267
flow(),
63-
commonjs({ include: 'node_modules/**' }),
68+
umd && commonjs({ include: 'node_modules/**' }),
6469
babel({
6570
exclude: 'node_modules/**',
6671
babelrc: false,

0 commit comments

Comments
 (0)