Skip to content
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

JSX/Babel does not work in html pane. #4

Closed
sergey-lapin opened this issue Jan 21, 2016 · 1 comment
Closed

JSX/Babel does not work in html pane. #4

sergey-lapin opened this issue Jan 21, 2016 · 1 comment

Comments

@sergey-lapin
Copy link

{
    files: [{
      type: 'html',
      content: '<html>\n' +
                '   <head>\n' +
                '       <script src="https://fb.me/react-0.14.6.js"></script>\n' +
                '       <script src="https://fb.me/react-dom-0.14.6.js"></script>\n' +
                '       <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>\n' +
                '   </head>\n' +
                '   <body>\n' +
                '       <div id="content"/>\n' +
                '   </body>\n' +
                '   <script language="javascript" type="text/babel">\n' +
                '         ReactDOM.render(\n' +
                '           <span>Hello, world!</span>,\n' +
                '           document.getElementById("content")\n' +
                '         );        \n' +
                '   </script>\n' +
                '</html>\n'
    }]
}

returns:
Uncaught SyntaxError: Unexpected token <
Same works if you copy-paste it to html file and open it in browser.

@ghinda ghinda closed this as completed in 8b816e9 Jan 22, 2016
@ghinda
Copy link
Owner

ghinda commented Jan 22, 2016

Thanks for reporting! 🍻

It was caused by two issues.

  • One was that I was running all script tags, regardless if they had a standard type attribute. I'm now running only scripts with a standard type, or without a type, just like the standard browser behavior.
  • The other was that babel's browser.js relies on DOMContentLoaded. The default browser behavior is to trigger it after all scripts are loaded, so now I'm mimicking that too.

I released the fixed as 1.0.3. After you upgrade everything should be working.
I'm also looking at the other issue you posted. Hopefully I'll get a fix for it later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants