diff --git a/.changeset/funny-gifts-grin.md b/.changeset/funny-gifts-grin.md new file mode 100644 index 000000000..afbffcbb5 --- /dev/null +++ b/.changeset/funny-gifts-grin.md @@ -0,0 +1,5 @@ +--- +'@react-pdf/renderer': minor +--- + +fix react peer dependency problem diff --git a/packages/renderer/package.json b/packages/renderer/package.json index 85bdbc0df..63ff65913 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -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": [ @@ -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" } diff --git a/packages/renderer/rollup.config.js b/packages/renderer/rollup.config.js index 033b2b48c..2de976814 100644 --- a/packages/renderer/rollup.config.js +++ b/packages/renderer/rollup.config.js @@ -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), ]; @@ -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()] : []), diff --git a/packages/renderer/src/renderer.js b/packages/renderer/src/renderer.js index 5a69d3220..93205bed0 100644 --- a/packages/renderer/src/renderer.js +++ b/packages/renderer/src/renderer.js @@ -1,3 +1,4 @@ +/* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-unused-vars */ /* eslint-disable no-param-reassign */ diff --git a/yarn.lock b/yarn.lock index deabb7c44..b9715d7fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8852,7 +8852,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==