Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions packages/sdk/browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better than a regex even.

},
}
};

export default [
{
...getSharedConfig('es', 'dist/index.es.js'),
Expand All @@ -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 }),
Expand All @@ -51,13 +57,7 @@ export default [
typescript(),
common(),
resolve(),
terser({
mangle: {
properties: {
regex: /^_/,
},
},
}),
terser(terserOpts),
json(),
],
},
Expand Down