Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bundling ReactDOM #2

Merged
merged 3 commits into from
Jul 17, 2018
Merged
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
26 changes: 15 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
{
"name": "react-final-form-html5-validation",
"version": "1.0.0",
"description":
"A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation",
"description": "A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my npm formats package.json when doing a fresh install for some reason, no idea how to stop it (havent searched for it though 😉 ). Hope it's ok

"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 <[email protected]> (http://github.com/erikras)",
"author": "Erik Rasmussen <[email protected]> (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",
Expand Down Expand Up @@ -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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was added! this peer dep was already required, only not in package.json

"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": [
{
Expand Down
9 changes: 7 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -49,18 +53,19 @@ export default {
exports: 'named',
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'prop-types': 'PropTypes',
'final-form': 'FinalForm',
'react-final-form': 'ReactFinalForm'
}
},
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/**' }),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just extra guard, for non-umd build u dont want to use this plugin at all

babel({
exclude: 'node_modules/**',
babelrc: false,
Expand Down