-
Notifications
You must be signed in to change notification settings - Fork 24
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
SWC-7242 #1565
SWC-7242 #1565
Conversation
- Update synapse-react-client ESM/CJS bundles to use 'UMD' entry file. SynapseWebClient will use this new bundle in a future change. In the future, we will also replace `src/index.ts` with the contents of `src/umd.index.ts` and delete the UMD-specific build processes. - Include @sage-bionetworks/synapse-types in the synapse-react-client bundled output since it is prone to drift from the version on NPM, since we do not typically release every @sage-bionetworks/synapse-types change to NPM. While this is a breaking change, no known applications currently use the synapse-react-client ESM/CJS bundles, so it should be safe.
@@ -5,15 +5,14 @@ import viteLibraryConfig from './vite-library-config.js' | |||
import vitestConfig from './vitest-config.js' | |||
|
|||
export class ConfigBuilder { | |||
private includeReactConfig = 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.
This can be captured in the existing pluginConfigOptions
instance variable, so I removed it.
return this | ||
} | ||
|
||
setPluginConfigOptions( |
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.
This method was unused.
externalizeDepsOptions?: Parameters< | ||
typeof getPluginConfig | ||
>[0]['externalizeDepsOptions'], |
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.
Expose new option to pass arguments to the externalizeDeps
plugin.
'@sage-bionetworks/synapse-types', | ||
], | ||
}) | ||
.setBuildLibEntry(resolve(__dirname, 'src/umd.index.ts')) |
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.
I updated this config to use the umd.index.ts
file, which represents "the set of synapse-react-client modules used in SWC", and has nothing to do with the UMD module format. This is a breaking change for any application that retrieves synapse-react-client from NPM and uses the ESM/CJS bundles. However, I do not think that any applications do this today.
In the near future, I plan to make this more clear. I will update file names and (once SynapseWebClient no longer uses it) remove the UMD-specific bundle scripts so we just have one build that creates ESM/CJS packages for SynapseWebClient to consume.
For this PR, I'm just trying to minimize the changes to get this working.
Update our bundle config so that we build and distribute the modules used by SWC. In Sage-Bionetworks/SynapseWebClient#5630 we are adding a bundler to SWC that can handle more modern ESM & CJS code, so we can update synapse-react-client to emit ESM/CJS versions of the same bundle here and later remove the UMD bundle.
src/index.ts
with the contents ofsrc/umd.index.ts
and delete the UMD-specific build processes.While this is a breaking change, no known applications currently use the synapse-react-client ESM/CJS bundles, so it should be safe.