Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spencercarnage/5078168 to your computer and use it in GitHub Desktop.
Save spencercarnage/5078168 to your computer and use it in GitHub Desktop.
require.js is loading the data-main script twice
<!DOCTYPE doctype 5>
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title></title>
<meta name="description" content=""/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<script data-main="js/test" src="/js/libs/require-2.1.4.js"></script>
</head>
<body>
</body>
</html>
// test.js
require(['test1'], function (Test1) {
new Test1();
console.log('test loaded');
});
// test1.js
define(function () {
return function () {
console.log('test 1 loaded');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment