0

I've compiled this program with Purescript 0.12.5 but when I look at the index.html in Firefox 67.0.2 I get the following error in the web console:

Error: Target container is not a DOM element. app.js:5160:15

Here is the index.html file:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>PS3</title>   

<script src="https://unpkg.com/react@16/umd/react.production.min.js"
   crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-   
   dom.production.min.js" crossorigin></script>

<script src='app.js'></script>
</head>
<body>
<div id="app"></div>

</body>
</html>

Any help would be appreciated!

user1023733
  • 805
  • 5
  • 14

1 Answers1

1

This is because you're loading the program before the <div id="app"> element, so the element doesn't yet exist at the time the program is running and trying to find it.

Try moving the <script> tag after the <div>:

<html>
<head>
  ...
</head>
<body>
  <div id="app"></div>
  <script src='app.js'></script>
</body>
</html>
Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172