From 040af1be15e6bd7c28456ef9971a29d5ceec17a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 17 Jul 2018 22:39:46 +0200 Subject: [PATCH 1/3] Fixed bundling ReactDOM --- package.json | 26 +++++++++++++++----------- rollup.config.js | 9 +++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index d664479..ac3d3e3 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,29 @@ { "name": "react-final-form-html5-validation", "version": "1.0.0", - "description": - "A swap-in replacement for 🏁 React Final Form's component to provide HTML5 Validation", + "description": "A swap-in replacement for 🏁 React Final Form's component to provide HTML5 Validation", "main": "dist/react-final-form-html5-validation.cjs.js", "jsnext:main": "dist/react-final-form-html5-validation.es.js", "module": "dist/react-final-form-html5-validation.es.js", "sideEffects": false, - "files": ["dist"], + "files": [ + "dist" + ], "scripts": { "start": "nps", "test": "nps test", "precommit": "lint-staged && npm start validate" }, - "author": - "Erik Rasmussen (http://github.com/erikras)", + "author": "Erik Rasmussen (http://github.com/erikras)", "license": "MIT", "repository": { "type": "git", "url": "https://github.com/final-form/react-final-form-html5-validation.git" }, "bugs": { - "url": - "https://github.com/final-form/react-final-form-html5-validation/issues" + "url": "https://github.com/final-form/react-final-form-html5-validation/issues" }, - "homepage": - "https://github.com/final-form/react-final-form-html5-validation#readme", + "homepage": "https://github.com/final-form/react-final-form-html5-validation#readme", "devDependencies": { "babel-eslint": "^8.2.2", "babel-jest": "^22.4.1", @@ -71,13 +69,19 @@ "final-form": ">=4.0.0", "prop-types": "^15.6.0", "react": "^15.3.0 || ^16.0.0-0", + "react-dom": "^15.3.0 || ^16.0.0-0", "react-final-form": ">=3.0.0" }, "jest": { - "setupFiles": ["raf/polyfill"] + "setupFiles": [ + "raf/polyfill" + ] }, "lint-staged": { - "*.{js*,ts*,json,md,css}": ["prettier --write", "git add"] + "*.{js*,ts*,json,md,css}": [ + "prettier --write", + "git add" + ] }, "bundlesize": [ { diff --git a/rollup.config.js b/rollup.config.js index 03e08de..bcabb13 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -4,6 +4,7 @@ import flow from 'rollup-plugin-flow' import commonjs from 'rollup-plugin-commonjs' import uglify from 'rollup-plugin-uglify' import replace from 'rollup-plugin-replace' +import pkg from './package.json' const minify = process.env.MINIFY const format = process.env.FORMAT @@ -41,6 +42,9 @@ if (es) { throw new Error('no format specified. --environment FORMAT:xxx') } +const deps = Object.keys(pkg.dependencies || {}) +const peers = Object.keys(pkg.peerDependencies || {}) + export default { input: 'src/index.js', output: Object.assign( @@ -49,6 +53,7 @@ export default { exports: 'named', globals: { react: 'React', + 'react-dom': 'ReactDOM', 'prop-types': 'PropTypes', 'final-form': 'FinalForm', 'react-final-form': 'ReactFinalForm' @@ -56,11 +61,11 @@ export default { }, output ), - external: ['react', 'prop-types', 'final-form', 'react-final-form'], + external: umd ? peers : deps.concat(peers), plugins: [ resolve({ jsnext: true, main: true }), flow(), - commonjs({ include: 'node_modules/**' }), + umd && commonjs({ include: 'node_modules/**' }), babel({ exclude: 'node_modules/**', babelrc: false, From 6eb8978a9434c48a64522aa878d1f313c5a52c1f Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jul 2018 22:42:25 +0200 Subject: [PATCH 2/3] Undid prettier weirdnesses (?) --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index ac3d3e3..a1accb9 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,6 @@ "final-form": ">=4.0.0", "prop-types": "^15.6.0", "react": "^15.3.0 || ^16.0.0-0", - "react-dom": "^15.3.0 || ^16.0.0-0", "react-final-form": ">=3.0.0" }, "jest": { From 953a2e3bb6bf8e84e470b33199b90e28aa3a35fa Mon Sep 17 00:00:00 2001 From: Erik Rasmussen Date: Tue, 17 Jul 2018 22:48:35 +0200 Subject: [PATCH 3/3] Added back react-dom peerDep --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index a1accb9..ac3d3e3 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "final-form": ">=4.0.0", "prop-types": "^15.6.0", "react": "^15.3.0 || ^16.0.0-0", + "react-dom": "^15.3.0 || ^16.0.0-0", "react-final-form": ">=3.0.0" }, "jest": {