tutorialkit
tutorialkit copied to clipboard
Referencing a template file from _file results in build error
Describe the bug
When using typescript, I import a file that exist in the template, from a source file in a lession it works, but fails to build.
Link to a StackBlitz project which shows the error
https://github.com/noam-honig/play-with-tutorial-kit/tree/demo-reference-to-file-in-template
Steps to reproduce
Here's my code: https://github.com/noam-honig/play-with-tutorial-kit/tree/demo-reference-to-file-in-template
In essence, I took the basic template, replace vite to support react and typescript.
Added a file:
src\templates\default\other-function.ts
export function otherFunction() {
alert("other function ");
}
Added a file:
src\content\tutorial\1-basics\1-introduction\1-welcome\_files\test.ts
import { otherFunction } from "./other-function";
export function test() {
otherFunction();
}
It works well when I developer, but it fails build.
There are valid use cases, where I want my user to focus on a specific file, while using code in other files of the project that exist in the template, without seeing them in each lesson
Expected behavior
I wish it would build :)
Screenshots
No response
Platform
- TutorialKit version: 0.1.2
- OS: wsl windows
- Browser: [e.g. Chrome, Safari, Firefox]
- Version: [e.g. 91.1]
Additional context
No response
I've used exclude: ['src/content'] to avoid these errors. I'm not sure if it's even possible to fix this properly for typescript.
https://github.com/AriPerkkio/tutorial-vite-plugin/blob/1f161a22bd80c9529ceeac8080dfb27f3db8a318/tsconfig.json#L12