Skip to content

Commit

Permalink
Update demo app readme
Browse files Browse the repository at this point in the history
  • Loading branch information
guyca committed Nov 14, 2024
1 parent d15ca52 commit 424f603
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions packages/swc-plugin-obsidian/demo/README.md
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.

0 comments on commit 424f603

Please sign in to comment.