diff --git a/packages/sdk/browser/rollup.config.js b/packages/sdk/browser/rollup.config.js index 4ac931184..550533ccf 100644 --- a/packages/sdk/browser/rollup.config.js +++ b/packages/sdk/browser/rollup.config.js @@ -21,6 +21,18 @@ const getSharedConfig = (format, file) => ({ }, }); +const terserOpts = { + mangle: { + properties: { + // Mangle class properties which start with an underscore. + regex: /^_/, + // Do not mangle '_meta', because this is part of our JSON + // data model. + reserved: ['_meta'] + }, + } +}; + export default [ { ...getSharedConfig('es', 'dist/index.es.js'), @@ -33,13 +45,7 @@ export default [ esmExternals: true, }), resolve(), - terser({ - mangle: { - properties: { - regex: /^_/, - }, - }, - }), + terser(terserOpts), json(), // The 'sourcemap' option allows using the minified size, not the size before minification. visualizer({ sourcemap: true }), @@ -51,13 +57,7 @@ export default [ typescript(), common(), resolve(), - terser({ - mangle: { - properties: { - regex: /^_/, - }, - }, - }), + terser(terserOpts), json(), ], },