Compiled HTML looks faulty: __source / __self [object Object]
See original GitHub issueHey guys!
I’m sitting with a freshly installed create-react-app which I’ve converted to Preact with the simple steps. I get this weird issue when compiling my jsx files with Preact, and can’t really find the root of cause.
My Index.jsx
import { h, render } from 'preact';
import registerServiceWorker from './utilities/registerServiceWorker';
render(
<div className="app">
<p className="app-intro">
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>,
document.getElementById('root')
);
registerServiceWorker();
The compiled HTML file
<div class="app" __source="[object Object]" __self="[object Object]">
<button class="app-intro" __source="[object Object]" __self="[object Object]">
To get started, edit <code __source="[object Object]" __self="[object Object]">src/App.js</code> and save to reload.
</button>
>
Does anybody have an idea of what might could be the problem?
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Compiled HTML looks faulty: __source / __self ... - GitHub
I get this weird issue when compiling my jsx files with Preact, and can't really find the root of cause. My Index.jsx. import...
Read more >The 10 Most Common JavaScript Issues Developers Face
If you need help figuring out why your JavaScript isn't working, consult this list of the 10 most common JavaScript issues from a...
Read more >Content Configuration - Tailwind CSS
This guide covers everything you need to know to make sure Tailwind generates all of the CSS needed for your project. . Configuring...
Read more >Emscripten Compiler Frontend (emcc)
The input file(s) can be either source code files that Clang can handle (C or C++), object files (produced by emcc -c ),...
Read more >Troubleshooting CI/CD - GitLab Docs
GitLab provides several tools to help make troubleshooting your pipelines easier. This guide also lists common issues and possible solutions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay
create-react-app
uses the babel plugins: transform-react-jsx-source and transform-react-jsx-self by default in none-production builds. Preact doesn’t support those “special” attributes and just adds them as a stringified version to the dom. In a production build those attributes won’t exist.If you are using
create-react-app
to have an easy quick start, you can also take a look at preact-cli.I configured my babel like this, and it works as expected.
Thanks for the help guys! 💪