Skip to content

Commit 867ab74

Browse files
committed
feat(build): Allow passing Sucrase options for rollup
This allows you to configure Sucrase for rollup bundles. Needed for our work on the Feedback screenshotting feature as we want to use Preact + JSX in the project. (ref: #10590)
1 parent 4315345 commit 867ab74

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import { mergePlugins } from './utils.mjs';
2323
const BUNDLE_VARIANTS = ['.js', '.min.js', '.debug.min.js'];
2424

2525
export function makeBaseBundleConfig(options) {
26-
const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig } = options;
26+
const { bundleType, entrypoints, licenseTitle, outputFileBase, packageSpecificConfig, sucrase } = options;
2727

2828
const nodeResolvePlugin = makeNodeResolvePlugin();
29-
const sucrasePlugin = makeSucrasePlugin();
29+
const sucrasePlugin = makeSucrasePlugin(sucrase);
3030
const cleanupPlugin = makeCleanupPlugin();
3131
const markAsBrowserBuildPlugin = makeBrowserBuildPlugin(true);
3232
const licensePlugin = makeLicensePlugin(licenseTitle);

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ export function makeBaseNPMConfig(options = {}) {
2929
hasBundles = false,
3030
packageSpecificConfig = {},
3131
addPolyfills = true,
32+
sucrase = {},
3233
} = options;
3334

3435
const nodeResolvePlugin = makeNodeResolvePlugin();
35-
const sucrasePlugin = makeSucrasePlugin({ disableESTransforms: !addPolyfills });
36+
const sucrasePlugin = makeSucrasePlugin({ disableESTransforms: !addPolyfills, ...sucrase });
3637
const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin();
3738
const cleanupPlugin = makeCleanupPlugin();
3839
const extractPolyfillsPlugin = makeExtractPolyfillsPlugin();

0 commit comments

Comments
 (0)