obsidianmd/obsidian-developer-docs

Settings in `Use React in your plugin` is wrong

julianosirtori opened this issue · 1 comments

The step 3 on Configure your plugin is wrong.

I follow this step on obsidian-sample-plugin and I get this error:

app.js:1 Plugin failure: hello-world SyntaxError: Unexpected token '<' (at VM1002 plugin:hello-world:23534:10)
    at eval (<anonymous>)
    at app.js:1:2026541
    at e.<anonymous> (app.js:1:2026642)
    at app.js:1:237258
    at Object.next (app.js:1:237363)
    at a (app.js:1:236081)

When I make this change on tsconfig.ts works for me:

{
  "compilerOptions": {
    "jsx": "react-jsx"
  }
}

I can make this adjustment on documentation, but I would like like confirm this fix is correct?

I encountered the same issue, changing "jsx": "preserve" to "jsx": "react" made it work.
Your adjustment is better as it eliminates the need to add import React from 'react' in every tsx file.

It seems that the documentation should be updated.