d3-textwrap icon indicating copy to clipboard operation
d3-textwrap copied to clipboard

Import and Export Errors loading in script element

Open theory opened this issue 4 years ago • 0 comments

I'm using the syntax from the docs:

<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript" src="https://d3js.org/d3.v5.min.js"></script>
    <script type="text/javascript" src="textwrap.js"></script>
  </head>
  <body>
    <div id="graph"></div>
  </body>
</html>

But on Safari I get this error:

Unexpected token '{'. import call expects exactly one argument. textwrap.js:1

And on Firefox:

SyntaxError: import declarations may only appear at top level of a module textrap.js:1

Looks like the example was added recently (#15), but perhaps I'm missing something? Do I need to change the source file to load this way?

theory avatar Jun 11 '20 19:06 theory