1 Antwort

Vermutlich ist der Importpfad nicht richtig. Er geht vom Ablageort der JavaScript-Datei aus, die ihn importiert.

Beispiel:

index.html:

<!doctype html>
<title>Example</title>
<script src="js/main.js" type="module"></script>

js/main.js:

import { sayHello } from "./modules/sayHello.js";

sayHello();

js/modules/sayHello.js:

export function sayHello() { alert("Hello"); }