Open smrutirekhasamal opened 9 years ago
Did you bundle the runtime.js file? On Aug 20, 2015 4:15 AM, "smrutirekhasamal" notifications@github.com wrote:
Hi, I have created build-module.js, which is a bundle of all the modules. However while trying to run in browser, it shows "ReferenceError: System is not defined" error. Please help me resolving this and to run in browser.
Thank you
— Reply to this email directly or view it on GitHub https://github.com/google/traceur-compiler/issues/1986.
How to do it?
My code from example/hello.html
<!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
<script src="../src/runtime/runtime.js"></script>
<script src="../bin/traceur.js"></script>
<script src="../src/bootstrap.js"></script>
</head>
<body>
<script type="module">
class Greeter {
constructor(message) {
this.message = message;
}
greet() {
var element = document.querySelector('#message');
element.innerHTML = this.message;
}
};
document.addEventListener("DOMContentLoaded", function(event) {
var greeter = new Greeter('Hello, world!');
greeter.greet();
});
</script>
<h1 id="message"></h1>
</body>
</html>
Uncaught ReferenceError: System is not defined at bootstrap.js:15 Now with runtime.js
I have this error also on this page http://google.github.io/traceur-compiler/example/hello.html (Last Chrome on Windows 10)
<!DOCTYPE html>
<html>
<head>
<title>Hello, World!</title>
<script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/bin/BrowserSystem.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
</head>
<body>
<script type="module">
class Greeter {
constructor(message) {
this.message = message;
}
greet() {
var element = document.querySelector('#message');
element.innerHTML = this.message;
alert(message);
}
};
//document.addEventListener("DOMContentLoaded", function(event) {
var greeter = new Greeter('Hello, world!');
greeter.greet();
// });
</script>
<h1 id="message"></h1>
</body>
</html>
As @miodrag-manic-rs code shows, adding BrowserSystem.js should do it IIRC. @johnjbarton
Yes, this is solution, thanks!
Hi, I have created build-module.js, which is a bundle of all the modules. However while trying to run in browser, it shows "ReferenceError: System is not defined" error. Please help me resolving this and to run in browser.
Thank you