Ideas for Arc XP

Allow dropping ES5 support

According to this page: https://dev.arcxp.com/pagebuilder-engine/how-to-guides/migration-guides/adopting-webpack-5-in-your-bundle/

Emitted runtime code remains ES5-compatible. ... These are candidates for future opt-in improvements. If one matters to your team, tell us, that’s what prioritizes the roadmap.

Dropping es5 compatibility would be very appreciated, so {...a} and similar do not get converted.

Use-Case:
We generate server-rendered script tags so they run early (before fusion starts) and want those still to be written in TypeScript. When using someFunction.toString(), the transpiled code will be returned (and embedded in the script tags innerHTML), but without references like _objectSpread. Thus these kind of script tags fail currently if we use es6 features.

Reduced example:

export function FnToScript({ fn }: { fn: (window: Window) => void }): JSX.Element;
export function FnToScript<T>({ fn, params }: { fn: (window: Window, params: T) => void; params: T }): JSX.Element;
export function FnToScript<T>({ fn, params }: { fn: (window: Window, params: T) => void; params?: unknown }) {
const paramsValue = params === undefined ? '' : JSON.stringify(params);
const scriptContent = `(${fn.toString()})(window, ${paramsValue})`;

return <script dangerouslySetInnerHTML={{ __html: scriptContent }} />;
}

export function provideSendAppToWebEvent(window: Window) {
window.sendAppToWebEvent = function sendAppToWebEvent(eventName, params) {
window.dispatchEvent(
new CustomEvent(eventName, {
// if this would be `detail: { ...params }`, it would fail due to es5 compatibility conversions:
detail: params,
})
);
};
}

export const SendDataFromApp: FC = () => <FnToScript fn={provideSendAppToWebEvent} />;
  • Santo Pfingsten
  • Nov 17 2026
  • Needs review
  • Attach files