stackblitz / tutorialkit

TutorialKit by StackBlitz - Create interactive tutorials powered by the WebContainer API
https://tutorialkit.dev
MIT License
503 stars 48 forks source link

With custom vite config, reloading no longer works #401

Closed NullVoxPopuli closed 2 weeks ago

NullVoxPopuli commented 2 weeks ago

Describe the bug

When I edit a file, I would expect changes to be present in the output, but the vite server logs show no such detected change (in the toggled terminal)

Link to a StackBlitz project which shows the error

https://github.com/NullVoxPopuli/warp-drive-tutorial

Steps to reproduce

  1. clone https://github.com/NullVoxPopuli/warp-drive-tutorial
  2. cd ./warp-drive-tutorial
  3. pnpm install
  4. pnpm start
  5. try typing in either the gts file or the js file
  6. or click "solve" -- the application.gts file contents are replaced, but the server does not detect said change

Expected behavior

When I type in the editor, changes are reflected

Screenshots

n/a

Platform

❯ pnpm ls @tutorialkit/*

dependencies:
@tutorialkit/react 1.1.1

devDependencies:
@tutorialkit/astro 1.1.1
@tutorialkit/theme 1.1.1
@tutorialkit/types 1.1.1

Additional context

Does something special need to happen with the server.watch config?

AriPerkkio commented 2 weeks ago

The paths in _files are not correct when comparing to the TutorialKit's src/templates directory. With following change the reloading starts to work correctly as correct files are now being modified:

src/content/tutorial
└── 1-basics/1-introduction/1-welcome
    ├── _files
-   │   └── templates
-   │       ├── application.gts
-   │       └── example.js
+   │   └── app
+   │       └── templates
+   │           ├── application.gts
+   │           └── example.js
    ├── _solution
-   │   └── templates
-   │       └── application.gts
+   │   └── app
+   │       └── templates
+   │           └── application.gts
    └── content.md

tk-reload-ember.webm

NullVoxPopuli commented 2 weeks ago

Ah of course! Can't believe i missed that. Thank you!