Skip to content

Vite migration#13

Open
stefnotch wants to merge 10 commits into
mainfrom
vite-migration
Open

Vite migration#13
stefnotch wants to merge 10 commits into
mainfrom
vite-migration

Conversation

@stefnotch
Copy link
Copy Markdown
Collaborator

@stefnotch stefnotch commented Oct 25, 2025

Fix #8
Fix #9

This PR is split up into commits to make reviewing more straightforward.

The first commit does the following

  • move the files into the src folder. That's what vite's default config expects
  • rename our jsconfig to tsconfig. It semantically remains the same thing and we still use just Javascript. This renaming is just because IIRC, vite first looks for a tsconfig
  • adds the vite .gitignore

The next commit adds vite

  • adds a package.json with vite
  • adds instructions in the readme

Then I make use of npm

  • Adding the official webgpu types via npm
  • And removing the unused lib folder

Now I can finally make use of ES modules

  • The index.html file no longer directly references the scripts. Instead each script has import statements.
  • One nasty detail is that typical Javascript only has relative import statements. Like import { LOADER } from "../src/loader"; But we need absolute paths so that we can copy paste the solutions. So I do a bit of configuration in the tsconfig and in vite to make that work.
    • (Ideally that'd happen via an import map or without any vite configuration. But alas, we aren't there yet.)
  • I did not yet switch over the shaders.

Change shaders to .wgsl

  • Hooray, we finally have .wgsl files!
  • As an additional superpower, the reference solutions can be tried out even faster now. Just write import { Tutorial } from "./tasks/task3.js"; in the index.html file
  • (Ideally the import statements would say import heatmapCompute from "././shaders/heatmapCompute.wgsl" with { type: "text" }; instead of the vite specific ?raw. But it'll take a while longer for those text import statements to get widely adopted.)

And load the dataset from the local server

  • We finally no longer do silly round-trips to GitHub. Now even the big dataset loads really quickly.

Then I do a quick edit to the readme.

And finally, I move our final dependency to npm

@Welko Welko changed the base branch from main to debug-labels October 26, 2025 09:22
@Welko Welko changed the base branch from debug-labels to main October 26, 2025 09:23
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.

Codesandbox option Try out vite

1 participant