requirex / requirex

A different kind of module loader 📦🦖

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example doesn't work

ISNIT0 opened this issue · comments

The example:

<!doctype html>
<html><head>
  <title>Hello requirex</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <!-- Use requirex. -->
  <script src="https://cdn.jsdelivr.net/npm/requirex"></script>
  <script type="x-req-application/javascript">
    // Your code goes below.
    import * as React from 'react';
    import * as ReactDOM from 'react-dom';

    const element = <h1 style={{ color: 'red' }}>Hello, World!</h1>;

    ReactDOM.render(element, document.body);
  </script>
</head><body>

</body></html>

Doesn't seem to work.
In Firefox I get:

Error: Parse error
    translating http://localhost:8080/#1.js
    importing http://localhost:8080#1.js from http://localhost:8080/ requirex:1:13289

Huh, wonder how come I never tested that. Several bugs were unearthed!

It's not just a little broken. The format-detecting JavaScript parser doesn't know how to handle JSX at all.

Should be finally fixed in v0.1.5.