Problem:
I have a trivial demo application which use requireJS. When require.min.js
script loads, it tries to load entry-point script. But, the Problem is that instead of localhost:8090/js/app.js
it tries to load localhost:8090/js/app.app
and fails.
Demo: You can see the whole app at GitHub.
=== Only if you don't like GutHub, here's my code ===
File structure
ProjectRoot
|-server.js
|-public/
|-index.html
|-js/
|-app.js
|-lib/
|-require.min.js
|-underscore.js
|-backbone.js
|-raphael.js
|-app/
|-..
server.js:
var express = require('express');
var app = express();
app.use('/', express.static(__dirname + '/public'));
app.listen(8090);
index.html:
<!DOCTYPE html>
<html>
<body>
</body>
<script src="js/lib/require.min.js" data-main="js/app.js"></script>
</html>
app.js:
require.config({
paths: {
'jquery': 'lib/jquery',
'raphael': 'lib/raphael'
},
shim: {
'lib/underscore': {
exports: '_'
},
'lib/backbone': {
deps: ["lib/underscore", "jquery"],
exports: 'Backbone'
}
}
});