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

Fix cache thrashing with runtime manganis support + introduce cross-platform asset resolver #58

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

jkelleyrtp
Copy link
Member

@jkelleyrtp jkelleyrtp commented Aug 3, 2024

fixes our duplicate builds, long rebuilds, and cache thrashing by watching a specific file instead of the MANGANIS_SUPPORT env.

Since RA doesn't pass that env var, we were constantly making the entire dioxus graph recompile. Instead, you now pass a file with the env MG_CONFIG_PATH, and then manganis will use that file as its rerun-if-changed.

This is "sticky," so to unset it, you either modify that file (remove it...) or set MG_CONFIG_PATH_RESET to some value and then the build script will re-run.

I'm not a big fan of "sticky" settings but it's either this or setting the env in config.toml which occasionally does have issues and still leads to rebuilds.

[env]
mg_basepath="blah"

Alternatively, instead of the terrible CLI I grafted onto a build script, we could simply have a deterministic place to watch, but that's hard to acquire since there's no great way of getting the target dir from a proc macro.

rust-lang/cargo#8710


The more I think about this the more I think we should be doing one of the below:

  • setting basepath in env via [env]
  • exposing all manganis configuration via [env] env vars (and documenting it this way...)
  • not setting basepath ever during dev and only during bundle/release
  • find an alternative solution entirely
  • no compile-time configuration of manganis at all (no fallbacks, always absolute routes (/a/b/c) relative to a bundle)
  • use the <base> element and only relative asset uri?
  • only use relative url and then build a proper directory structure?
  • basepath is a runtime construct only valid via Link

also, funny, next doesn't do basepaths for images https://nextjs.org/docs/app/api-reference/next-config-js/basePath#images but does it for links

@jkelleyrtp jkelleyrtp changed the title wip: configure manganis via a file configure manganis via a file Aug 3, 2024
@jkelleyrtp jkelleyrtp changed the title configure manganis via a file Fix cache thrashing with runtime manganis support + introduce cross-platform asset resolver Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant