Skip to content

Commit

Permalink
bundle react-reconciler to avoid peerDeps problem (#2140)
Browse files Browse the repository at this point in the history
* bundle react-reconciler to avoid peerDeps problem

* add changeset
  • Loading branch information
jeetiss authored Jan 28, 2023
1 parent 2343a99 commit 327f071
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-gifts-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-pdf/renderer': minor
---

fix react peer dependency problem
7 changes: 5 additions & 2 deletions packages/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
"@react-pdf/render": "^3.2.1",
"@react-pdf/types": "^2.1.1",
"queue": "^6.0.1",
"react-reconciler": "^0.23.0",
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.2",
"scheduler": "^0.17.0"
},
"peerDependencies": {
"react": "^16.8.6 || ^17.0.0"
"react": "^16.8.6 || ^17.0.0 || ^18.0.0"
},
"lint-staged": {
"*.js": [
Expand Down Expand Up @@ -66,6 +68,7 @@
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"process": "^0.11.10",
"react-reconciler": "0.23.0",
"size-limit": "^7.0.5",
"util": "^0.12.4"
}
Expand Down
8 changes: 3 additions & 5 deletions packages/renderer/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ const babelConfig = () => ({
});

const getExternal = ({ browser }) => [
'@babel/runtime/helpers/extends',
'@babel/runtime/helpers/objectWithoutPropertiesLoose',
'@babel/runtime/helpers/asyncToGenerator',
'@babel/runtime/regenerator',
/@babel\/runtime/,
...(browser ? [] : ['fs', 'path', 'url']),
...Object.keys(pkg.dependencies),
...Object.keys(pkg.dependencies).filter(name => name !== 'react-reconciler'),
...Object.keys(pkg.peerDependencies),
];

Expand All @@ -58,6 +55,7 @@ const getPlugins = ({ browser, minify = false }) => [
preventAssignment: true,
values: {
BROWSER: JSON.stringify(browser),
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
...(minify ? [terser()] : []),
Expand Down
1 change: 1 addition & 0 deletions packages/renderer/src/renderer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-unused-vars */
/* eslint-disable no-param-reassign */

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8847,7 +8847,7 @@ react-is@^16.8.1, react-is@^16.8.4:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

react-reconciler@^0.23.0:
react-reconciler@0.23.0:
version "0.23.0"
resolved "https://registry.yarnpkg.com/react-reconciler/-/react-reconciler-0.23.0.tgz#5f0bfc35dda030b0220c07de11f93131c5d6db63"
integrity sha512-vV0KlLimP9a/NuRcM6GRVakkmT6MKSzhfo8K72fjHMnlXMOhz9GlPe+/tCp5CWBkg+lsMUt/CR1nypJBTPfwuw==
Expand Down

0 comments on commit 327f071

Please sign in to comment.