-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,14 @@ | ||
# Getting Start | ||
A demo project showcasing how to integrate Obsidian with Vite and SWC. | ||
|
||
Install `yalc` to troubleshoot | ||
## Running the project | ||
```bash | ||
yarn install | ||
yarn dev | ||
``` | ||
Then open the app at `http://localhost:5173/` | ||
|
||
In the `swc-plugin-obsidian` run `yalc publish` | ||
|
||
Within the `vite-app` folder, run `yarn install` | ||
|
||
Run `yalc add [email protected]` | ||
|
||
Run `yarn dev` to spin up the project and open in browser at `http://localhost:5173/` | ||
|
||
Open the plugin inspector at `http://localhost:5173/__inspect/` | ||
|
||
## Running Tests | ||
|
||
There is a minimal test that can be run with `yarn test`. It will assert against the dom to check if the dependency was injected correctly. | ||
## Debugging | ||
To debug the SWC plugin, you can run `yarn dev:debug` which will open Chrome with the DevTools attached. Additionally, you can open the plugin inspector at `http://localhost:5173/__inspect/` to view the transpiled code. | ||
|
||
## Notes | ||
|
||
The obsidian plugin is commented out by default in the `vite.config.ts` file. | ||
Uncomment this line and it's import to begin troubleshooting. | ||
|
||
## Known Issues | ||
|
||
The `obsidian` plugin interferes with the react plugin, which automagically imports `React` into any tsx files. So there is as compile error that the `React` import was not found. You can work around this by importing `React` in `main.tsx` but this shouldn't be necessary. | ||
|
||
The `obsidian` plugin seems to mangle _any_ ts and tsx file. Ideally, it should only mangle files with obsidian decorators. | ||
The app is using [unplugin-swc](https://github.com/unplugin/unplugin-swc) to configure SWC. It's a drop in replacement for [vite-plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) and supports the same functionality while providing a more flexible API. |