Skip to content

Commit

Permalink
Fix commonjs and esm entries (#2170)
Browse files Browse the repository at this point in the history
* fix both esm and commonjs entries

* changeset
  • Loading branch information
jeetiss authored Jan 30, 2023
1 parent 2b10d53 commit b06f8f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-chicken-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@react-pdf/renderer': patch
---

fix both esm and commonjs entries
12 changes: 10 additions & 2 deletions packages/renderer/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import json from '@rollup/plugin-json';
import babel from '@rollup/plugin-babel';
import nodeResolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import alias from '@rollup/plugin-alias';
import ignore from 'rollup-plugin-ignore';
import { terser } from 'rollup-plugin-terser';
import sourceMaps from 'rollup-plugin-sourcemaps';
Expand Down Expand Up @@ -48,14 +49,21 @@ const getPlugins = ({ browser, minify = false }) => [
json(),
sourceMaps(),
...(browser ? [ignore(['fs', 'path', 'url'])] : []),
alias({
entries: {
'react-reconciler':
'react-reconciler/cjs/react-reconciler.production.min.js',
},
}),
babel(babelConfig()),
commonjs({ esmExternals: true, requireReturnsDefault: 'namespace' }),
commonjs({
esmExternals: ['scheduler'],
}),
nodeResolve({ browser, preferBuiltins: !browser }),
replace({
preventAssignment: true,
values: {
BROWSER: JSON.stringify(browser),
'process.env.NODE_ENV': JSON.stringify('production'),
},
}),
...(minify ? [terser()] : []),
Expand Down

0 comments on commit b06f8f4

Please sign in to comment.