JS: Module Path Syntax

By Xah Lee. Date: .

2018-03-19 in safari, this is error:

<script type="module" src="main.js"></script>

you get:

TypeError: Module specifier does not start with "/", "./", or "../".

must be like this

<script type="module" src="./main.js"></script>

2018-03-19 in safari, this is error

<script src="./main.js"></script>

you get

SyntaxError: Unexpected token '{'. import call expects exactly one argument.

must be

<script type="module" src="./main.js"></script>

If your code uses import or export, then it must be loaded as module.

BUY Ξ£JS JavaScript in Depth

JavaScript, Import/Export