Skip to content

Commit

Permalink
Use esbuild options which removes dependence on rollup and terser.
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Oct 28, 2024
1 parent 8067c05 commit 87ce8e0
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions packages/sdk/browser/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ export default defineConfig({
index: 'src/index.ts',
compat: 'src/compat/index.ts'
},
minify: 'terser',
terserOptions: {
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'],
},
},
},
minify: true,
format: ['esm', 'cjs'],
splitting: false,
sourcemap: false,
clean: true,
noExternal: ['@launchdarkly/js-sdk-common', '@launchdarkly/js-client-sdk-common'],
treeshake: true,
dts: true,
metafile: true,
minifyIdentifiers: true,
esbuildOptions(opts) {
// This would normally be `^_(?!meta|_)`, but go doesn't support negative look-ahead assertions,
// so we need to craft something that works without it.
// So start of line followed by a character that isn't followed by m or underscore, but we
// want other things that do start with m, so we need to progressively handle more characters
// of meta with exclusions.
opts.mangleProps = /^_([^m|_]|m[^e]|me[^t]|met[^a])/;
},
});

0 comments on commit 87ce8e0

Please sign in to comment.