Ben ES6 (ECMAScript'e 6) yeniyim ve ben tarayıcıda modül sistemini kullanmak istiyorum. Ben ES6 Firefox ve Chrome tarafından desteklenir, ancak ben export
ES6: Yakalanmayan SyntaxError: Beklenmeyen belirteç ithalat
Uncaught SyntaxError: Unexpected token import
Bir test.html dosyasını
<html>
<script src="test.js"></script>
<body>
</body>
</html>
ve test.js dosyasına sahip kullanarak aşağıdaki hatayı alıyorum okumak
'use strict';
class Test {
static hello() {
console.log("hello world");
}
}
export Test;
Neden?
ES6 * modülleri * henüz tarayıcıda desteklenmemektedir. Ayrıca hala bir komut dosyası değil, bir modül yüklüyorsunuz. – Bergi
Hala bir komut dosyası ile bir modül arasındaki farkı anlamıyorum – cdarwin
Bkz. [Burada] (http://stackoverflow.com/a/39652842/1048572) – Bergi