I am trying to import redom library but keep getting this error:
Uncaught TypeError: Cannot read property 'nodeType' of null
My code is listed below:
<!DOCTYPE html>
<html>
<head>
<script src='test.js'></script>
<script src="libraries/redom.min.js" type='text/javascript'></script>
<script>
const { el, mount } = redom;
const hello = el('h1', 'Hello World');
mount(document.body, hello);
</script>
</head>
<body>
</body>
</html>
If I change const { el, mount } = redom;
to import { el, mount } from 'redom'
, I get Uncaught SyntaxError: Unexpected token import
.
The path is correct, and redom.min.js is not broken.