Skip to content
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

UMD builds #154

Open
luxaritas opened this issue Sep 1, 2022 · 1 comment
Open

UMD builds #154

luxaritas opened this issue Sep 1, 2022 · 1 comment
Labels
priority: p4/minor There is a reasonable workaround, or there is a nice to have with limited impact scope: nx-plugin size: md type: enhancement New feature or request

Comments

@luxaritas
Copy link
Member

luxaritas commented Sep 1, 2022

Right now, our builds work as follows:

  • If in app mode, bundle, if in lib mode, don't bundle and externalize all dependencies
  • Compile both ESM and CJS output

However, this precludes distributing web/iso libraries as semi-contained UMD bundles. In order to do this, we would need to re-run vite build multiple times (ie, in the build script, presumably setting some environment var, disabling emptyOutDir for the later run(s)). It might look something like:

  1. Build "dev" ESM + CJS, unbundled, fully external dependencies
  2. Build UMD, bundled source, bundled dependencies
  3. Build UMD, bundled source, externalize only some specified dependencies (if specified - eg, we could make a build of a Vue library without Vue, assuming the consumer would already have it installed so we don't have to ship it again)
@luxaritas luxaritas added type: enhancement New feature or request scope: nx-plugin size: md priority: p4/minor There is a reasonable workaround, or there is a nice to have with limited impact labels Sep 1, 2022
@luxaritas
Copy link
Member Author

It's worth considering whether or not we want to take on the overhead of UMD builds - you can import ES modules via CDN (Vue includes instructions in their docs for doing that with Vue). However, we may still want to provide fully bundled/partially bundled ESM builds (and at that point, maybe UMD isn't much of a lift?). Eventually, it would be great to not even export to CJS, but I'm not sure if adoption is sufficiently high enough yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p4/minor There is a reasonable workaround, or there is a nice to have with limited impact scope: nx-plugin size: md type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant