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

Production Builds MVP #1

Closed
2 of 5 tasks
wycats opened this issue Jun 21, 2022 · 2 comments
Closed
2 of 5 tasks

Production Builds MVP #1

wycats opened this issue Jun 21, 2022 · 2 comments
Assignees
Labels
enhancement:performance Performance improvements
Milestone

Comments

@wycats
Copy link
Member

wycats commented Jun 21, 2022

We should make it easy to strip out runtime behavior that is only there for debug purposes.

Things to do:

  • Integrate the import.meta.env Vite de facto standard
  • Use conditionals to remove as much behavior as possible
  • Ship a debug entry point with debug features in and a prod entry point with debug features out
  • Figure out and document how to automate the use of the correct entry point in popular bundlers
  • Figure out how to make loose modules "just work" with downstream Vite users

Out of scope for this issue:

  • Figure out how to minimize the code size of unused production features.

This is important, but it's a little trickier, because it involves things like stripping out unused methods, which has implications for TypeScript. My preferred solution is to use build-time decorators with import.meta.env to remove unused behavior.

  • Transform the verify pattern (verify(expr, isPresent)) to remove the call to verify entirely.

This is very important, but requires a different kind of work than the primary work this ticket is about.

Both of these are important near-term follow-up issues.

@wycats wycats self-assigned this Jun 21, 2022
@wycats wycats added this to the Starbeam milestone Jun 21, 2022
@wycats wycats changed the title Debug Infrastructure Production Builds 1.0 Jun 22, 2022
@wycats wycats changed the title Production Builds 1.0 Production Builds MVP Jun 22, 2022
wycats added a commit that referenced this issue Jun 23, 2022
Note that this is about reducing the runtime overhead of dev-mode
constructs, not (yet) about eliminating them from the build.

1. use import.meta.env.PROD in user code
2. add `pnpm test:prod`, which runs the tests in prod mode
3. Make verify() and verified() noops in production
4. Update rollup.config.js to mirror how vite replaces import.meta.env

Note that the reason we have rollup.config.ts is because we need the
feature of rollup that allows us to create separate, distinct configs,
because we don't want the packages to share chunks with each other.
See [this vite issue].

[this vite issue]: vitejs/vite#1736
wycats pushed a commit that referenced this issue Jun 24, 2022
wycats added a commit that referenced this issue Jun 24, 2022
Note that this is about reducing the runtime overhead of dev-mode
constructs, not (yet) about eliminating them from the build.

1. use import.meta.env.PROD in user code
2. add `pnpm test:prod`, which runs the tests in prod mode
3. Make verify() and verified() noops in production
4. Update rollup.config.js to mirror how vite replaces import.meta.env

Note that the reason we have rollup.config.ts is because we need the
feature of rollup that allows us to create separate, distinct configs,
because we don't want the packages to share chunks with each other.
See [this vite issue].

[this vite issue]: vitejs/vite#1736
wycats added a commit that referenced this issue Jun 24, 2022
Start work on production builds (#1)
@wycats wycats modified the milestones: Starbeam 0.6, Starbeam 0.7 Aug 25, 2022
@wycats wycats modified the milestones: Starbeam 0.7, Starbeam 0.10 Apr 23, 2023
@wycats wycats added the enhancement:performance Performance improvements label Apr 23, 2023
@wycats wycats moved this to Implementing in Starbeam Roadmap Apr 23, 2023
@wycats wycats pinned this issue Apr 23, 2023
@NullVoxPopuli
Copy link
Contributor

Here is a PR that tries to use what's on main: NullVoxPopuli/latency-tester#9

We can use this to test out production mode:

At the time of writing, we still have:

  • inspect-utils
  • stacktracey
  • some lingering import.meta.env.DEV
  • nydus?
    image

@wycats
Copy link
Member Author

wycats commented Jul 15, 2024

Closing this out as the effort to identify a solid production build strategy is now happening in https://github.com/starbeamjs/starbeam-lite. That repo is a testbed for addressing some of the long-standing open questions in the Starbeam fundamentals. Once we get to the end of that exploration, this repo will and starbeam-lite will be merged.

@wycats wycats closed this as completed Jul 15, 2024
@github-project-automation github-project-automation bot moved this from Implementing to Implemented in Starbeam Roadmap Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement:performance Performance improvements
Projects
Status: Implemented
Development

No branches or pull requests

2 participants