Skip to content

Commit

Permalink
add preventAssignment option to replace plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jeetiss committed Nov 24, 2021
1 parent 6f36a05 commit c3ab7e5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 12 deletions.
5 changes: 4 additions & 1 deletion packages/font/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const getPlugins = ({ browser }) => [
sourceMaps(),
babel(babelConfig({ browser })),
replace({
BROWSER: JSON.stringify(browser),
preventAssignment: true,
values: {
BROWSER: JSON.stringify(browser),
},
}),
];

Expand Down
10 changes: 8 additions & 2 deletions packages/fontkit/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ const serverConfig = Object.assign({}, configBase, {
plugins: configBase.plugins.concat(
babel(babelConfig({ browser: false })),
replace({
BROWSER: JSON.stringify(false),
preventAssignment: true,
values: {
BROWSER: JSON.stringify(false),
},
}),
),
external: configBase.external.concat(['fs', 'brotli/decompress']),
Expand All @@ -80,7 +83,10 @@ const browserConfig = Object.assign({}, configBase, {
plugins: configBase.plugins.concat(
babel(babelConfig({ browser: true })),
replace({
BROWSER: JSON.stringify(true),
preventAssignment: true,
values: {
BROWSER: JSON.stringify(true),
},
}),
ignore(['fs', 'brotli', 'brotli/decompress', './WOFF2Font']),
),
Expand Down
11 changes: 8 additions & 3 deletions packages/image/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const serverConfig = {
plugins: [
sourceMaps(),
babel(babelConfig({ browser: false })),
replace({ BROWSER: JSON.stringify(false) }),
replace({
preventAssignment: true,
values: { BROWSER: JSON.stringify(false) },
}),
],
};

Expand All @@ -61,8 +64,10 @@ const browserConfig = {
plugins: [
sourceMaps(),
babel(babelConfig({ browser: true })),
replace({ BROWSER: JSON.stringify(true) }),
,
replace({
preventAssignment: true,
values: { BROWSER: JSON.stringify(true) },
}),
ignore(['fs', 'path', 'url']),
],
};
Expand Down
10 changes: 8 additions & 2 deletions packages/pdfkit/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ const serverConfig = Object.assign({}, configBase, {
],
plugins: configBase.plugins.concat(
replace({
BROWSER: JSON.stringify(false)
preventAssignment: true,
values: {
BROWSER: JSON.stringify(false)
}
}),
babel(babelConfig({ browser: false }))
),
Expand All @@ -86,7 +89,10 @@ const browserConfig = Object.assign({}, configBase, {
plugins: configBase.plugins.concat(
ignore(['fs']),
replace({
BROWSER: JSON.stringify(true)
preventAssignment: true,
values: {
BROWSER: JSON.stringify(true)
}
}),
babel(babelConfig({ browser: true }))
)
Expand Down
12 changes: 9 additions & 3 deletions packages/png-js/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ const serverConfig = Object.assign({}, configBase, {
],
plugins: configBase.plugins.concat(
replace({
BROWSER: JSON.stringify(false),
preventAssignment: true,
values: {
BROWSER: JSON.stringify(false),
},
}),
),
external: ['fs'],
Expand All @@ -66,8 +69,11 @@ const browserConfig = Object.assign({}, configBase, {
],
plugins: configBase.plugins.concat(
replace({
BROWSER: JSON.stringify(true),
'png-js': 'png-js/png.js',
preventAssignment: true,
values: {
BROWSER: JSON.stringify(true),
'png-js': 'png-js/png.js',
},
}),
ignore(['fs']),
),
Expand Down
5 changes: 4 additions & 1 deletion packages/renderer/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ const getPlugins = ({ browser }) => [
...configBase.plugins,
babel(babelConfig({ browser })),
replace({
BROWSER: JSON.stringify(browser),
preventAssignment: true,
values: {
BROWSER: JSON.stringify(browser),
},
}),
];

Expand Down

0 comments on commit c3ab7e5

Please sign in to comment.