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

Consider Vite #57

Open
5 of 21 tasks
v6ak opened this issue Oct 14, 2023 · 5 comments
Open
5 of 21 tasks

Consider Vite #57

v6ak opened this issue Oct 14, 2023 · 5 comments

Comments

@v6ak
Copy link
Owner

v6ak commented Oct 14, 2023

Usage in dev

  • HTML generation
  • years.json generation
  • CSV download
  • SASS processing
  • JS

Todo for production

  • JS bundle size
  • proper SSG
  • CI
  • relative paths

Checklist for production

  • JS bundle size
  • CSS file name
  • HTML
  • CSS
  • JS
  • CSV for 2015 (not critical for dev)
  • years.json
  • all paths are relative
  • verify asset fingerprinting
  • verify directory structure
  • CI
  • remove unneeded index.html

Depends on #56 (done).

@v6ak
Copy link
Owner Author

v6ak commented Oct 17, 2023

Static HTML

Probably feasible. In dev, we can use server-side rendering. For prod, we could somehow generate the files.

JS size

This is PITA:

  • Vite requires ESM. (CommonJS might be supported via some plugin. However, with ESM, Scala.JS disables Google Closure Compiler, which causes much larger binaries (approx. 1.9MiB vs. 1MiB).
  • Multiple modules (client + htmlgen) would be useful. But again, this disables Google Closure Compiler, even with CommonJS.
  • Maybe we could somehow call google-closure-compiler ourselves, but this is probably not an easy task.

Using Vite just for dev (and maybe SASS)

Vite requires minimal code changes, so we could use Vite for dev and SBT-web for prod. (And probably get rid of Play framework.) This way, we would probably still want to use SASS compilation by Vite, because sbt-sass uses an outdates SASS compiler and because it seems to be easier to integrate it this way than the other way around.

@v6ak v6ak changed the title Zvážit Vite Consider Vite Oct 17, 2023
@v6ak
Copy link
Owner Author

v6ak commented Oct 17, 2023

In order to share node_modules between scalajs-bundler and Vite, we could use NODE_PATH variable.

@v6ak
Copy link
Owner Author

v6ak commented Oct 19, 2023

JS size seems to be somehow manageable as long as I can use .withOptimizeBracketSelects(false) for basic linker.

@v6ak
Copy link
Owner Author

v6ak commented Oct 23, 2023

At this point, the feature/vite branch is somewhat useful. While I cannot build it, I can use it when developing (must faster turnaround) and then cherry-pick the commits to devel branch.

@v6ak
Copy link
Owner Author

v6ak commented Oct 23, 2023

When this is done, we can replace divisions in SCSS by math.div. Until then, we use an old SASS version, which doesn't allow to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant