Skip to content

Commit 72613ae

Browse files
carlobeltramediegomura
authored andcommitted
Polyfill Buffer in our own code
These instances will only appear when including an image in the pdf
1 parent 748b253 commit 72613ae

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/image/rollup.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import babel from '@rollup/plugin-babel';
22
import replace from '@rollup/plugin-replace';
33
import ignore from 'rollup-plugin-ignore';
44
import pkg from './package.json';
5+
import nodePolyfills from 'rollup-plugin-polyfill-node'
56

67
const cjs = {
78
format: 'cjs',
@@ -52,7 +53,10 @@ const getPlugins = ({ browser }) => [
5253
preventAssignment: true,
5354
values: { BROWSER: JSON.stringify(browser) },
5455
}),
55-
...(browser ? [ ignore(['fs', 'path', 'url']) ] : []),
56+
...(browser ? [
57+
ignore(['fs', 'path', 'url']),
58+
nodePolyfills({ include: [ /node_modules\/.+\.js/, /\/image\/src\/.*\.js/ ] }),
59+
] : []),
5660
];
5761

5862
const serverConfig = {

packages/png-js/rollup.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ const getPlugins = ({ browser }) => [
5353
}),
5454
commonjs(),
5555
nodeResolve({ browser, preferBuiltins: !browser }),
56-
nodePolyfills({ include: [ /node_modules\/.+\.js/ ] }),
57-
] : []),
56+
nodePolyfills({ include: [ /node_modules\/.+\.js/, /\/png-js\/src\/.*\.js/ ] }), ] : []),
5857
babel(babelConfig({ browser })),
5958
replace({
6059
preventAssignment: true,

0 commit comments

Comments
 (0)