Skip to content

Conversation

AriPerkkio
Copy link
Member

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@AriPerkkio
Copy link
Member Author

There's still an issue on @tutorialkit/astro > @tutorialkit/react-components HMR. The packages/template sees the update of @tutorialkit/react-components and HMR kicks in, but it's served from cached optimized deps from .vite/deps. Restarting Vite/Astro server of packages/template with --force works.

I've tried all kinds of combinations of optimizeDeps.exclude but so far nothing works.

Comment on lines +21 to +42
You may wish to test your locally-modified copy of TutorialKit against another package that is using it. For pnpm, after building TutorialKit, you can use [`pnpm.overrides`](https://pnpm.io/package_json#pnpmoverrides). Please note that `pnpm.overrides` must be specified in the root `package.json` and you must first list the package as a dependency in the root `package.json`:

```json
{
"pnpm": {
"overrides": {
"@tutorialkit/astro": "file:../tutorialkit/packages/astro",
"@tutorialkit/components-react": "file:../tutorialkit/packages/components/react",
"@tutorialkit/runtime": "file:../tutorialkit/packages/runtime",
"@tutorialkit/theme": "file:../tutorialkit/packages/theme",
"@tutorialkit/types": "file:../tutorialkit/packages/types"
}
}
}
Copy link
Member Author

@AriPerkkio AriPerkkio Jul 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works somewhat ok but is quite far from ideal. Due to file: usage, the project must re-run pnpm install after TutorialKit packages have updated.

Using link: would make changes automatically visible, but I was unable to solve issue where TutorialKit's dependencies brought multiple copies of React into the runtime and caused hooks to fail. With webpack this could be solved using resolve.alias but it just doesn't work with Vite.

@AriPerkkio AriPerkkio marked this pull request as ready for review July 16, 2024 09:41
@AriPerkkio AriPerkkio requested a review from Nemikolh July 16, 2024 09:41
@AriPerkkio
Copy link
Member Author

AriPerkkio commented Jul 16, 2024

There's still an issue on @tutorialkit/astro > @tutorialkit/react-components HMR.

Adding optimizeDeps on packages/astro seems to fix it - exactly as env.TUTORIALKIT_DEV does! 🥳

I tried to force it from the packages/template using @tutorialkit/astro > @tutorialkit/react-components in optimizeDeps. It should work, in theory at least.

Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I really like the improvement and normalization on the build script.

I would reduce a bit on the number of watch processes started though, I left some comments here and there to clarify where I think they could be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should use the same convention than for the rest of StackBlitz's repos. Curious to hear your thoughts @d3lm on the topic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(FYI this is from Vitest repo)

AriPerkkio and others added 3 commits July 16, 2024 13:28
Co-authored-by: Jòan <Nemikolh@users.noreply.github.com>
Copy link
Member

@Nemikolh Nemikolh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's goooo!!!

@Nemikolh Nemikolh merged commit 9673322 into stackblitz:main Jul 16, 2024
@AriPerkkio AriPerkkio deleted the chore/watch-mode branch July 16, 2024 15:19
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.

Watch mode for development
2 participants