-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Refine CJS/ESM build configuration for browser SDK. #640
Conversation
…DK-819/refine-build-configuration
"outDir": "dist", | ||
"skipLibCheck": true, | ||
// enables importers to jump to source | ||
"sourceMap": true, | ||
"sourceMap": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the bundle-size task I will add some conditional configuration to a dev build and source maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The esbuild support actually means it can generate a meta data file, which can be used for the analysis instead. So no debug builds for now.
splitting: false, | ||
sourcemap: false, | ||
clean: true, | ||
noExternal: ['@launchdarkly/js-sdk-common', '@launchdarkly/js-client-sdk-common'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, the one thing that wasn't great about tsup is that it doesn't bundle dependencies unless they are dev dependencies. Which sounds fine, but then you need to figure out how to handle the typescript for those packages.
It has a method to bundle the typescript into .d.ts files as well, but that very much didn't work.
So this instructs it to not treat these as external. It does mean that you get these installed for a production build even though they are not then used. But that has been the precedent.
If the bundling of the typing worked, then that would be a reasonable alternative.
// 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. | ||
// eslint-disable-next-line no-param-reassign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface works by modifying the input options, which means re-assigning.
I need to appease tsdoc. Which may be some minor changes. |
🤖 I have created a release *beep* *boop* --- <details><summary>js-client-sdk: 0.2.0</summary> ## [0.2.0](js-client-sdk-v0.1.0...js-client-sdk-v0.2.0) (2024-10-29) ### Features * Add a module for increased backward compatibility. ([#637](#637)) ([44a2237](44a2237)) * Refine CJS/ESM build configuration for browser SDK. ([#640](#640)) ([ec4377c](ec4377c)) * Vendor escapeStringRegexp to simplify builds. ([48cac54](48cac54)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.10.0 to 1.11.0 </details> <details><summary>js-client-sdk-common: 1.11.0</summary> ## [1.11.0](js-client-sdk-common-v1.10.0...js-client-sdk-common-v1.11.0) (2024-10-29) ### Features * Add a module for increased backward compatibility. ([#637](#637)) ([44a2237](44a2237)) </details> <details><summary>react-native-client-sdk: 10.9.1</summary> ## [10.9.1](react-native-client-sdk-v10.9.0...react-native-client-sdk-v10.9.1) (2024-10-29) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-client-sdk-common bumped from 1.10.0 to 1.11.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The goals here are to:
Currently we have worked around some build issues in other packages. Mainly with node module resolution. Despite the settings in the package.json node wants certain file extensions for certain types including .cts for the CJS type definitions.
So far tsup seems to be the simplest way to get all things with expected names without a multi-step process. Or without having to make a hack package.json that just has the modules type.
Please review #637 first.