-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does one use crank without a bundler? #124
Comments
Hello! I’m sorry to hear you’re having trouble. I think I need some more information about your situation. Which instructions are you referring to? Also, if you’re using JSX, you necessarily need a transpilation step of some kind. Do you have a minimal example that I can look at? |
Thanks for following up. I was following the Getting Started Installation instructions. Below is the code.
|
Hmmm, so as far as I can tell, the problem is that you’re using JSX in a vanilla JavaScript file. You need to either transpile it with something like babel, typescript or sucrase, or use an alternative syntax. You can, for instance, use createElement directly: function Greeting({ name = "World" }) {
return createElement("div", null, "Hello ", name);
} Or you can use something like htm: import { createElement } from "https://unpkg.com/@bikeshaving/[email protected]/index.js";
import { Renderer } from 'https://unpkg.com/@bikeshaving/[email protected]/dom.js';
import htm from 'https://unpkg.com/htm?module';
const html = htm.bind(createElement);
function Greeting({ name = "World" }) {
return html`<div> Hello ${name}</div>`;
} I like transpilation, but these options are available to you. Also check out the docs from this PR for more information. Let me know if this makes sense! |
Thanks for your explanation. |
Closing for housekeeping purposes. If you still need help feel free to reopen the issue! |
How does one use crank without a bundler? Following the installation instructions as-is, did not work. "Uncaught SyntaxError: Unexpected token '<'"
The text was updated successfully, but these errors were encountered: