Comments (3)
Cajon just allows using CommonJS syntax for a module API. So, like the AMD sugar syntax just without the define() wrapper. It does not assume or shim anything around how Node handles ID resolution. In particular, it does not do the require.extensions thing that Node does to handle different code types, like coffeescript (side note, that would be extremely expensive for a front-end browser loader, doing multiple network fetches, many that would be 404s).
If you have coffeescript in the project, then the dependency IDs need to have 'cs!' prefixes for the coffeescript files, if they are to be handled by require-cs (and have require-cs installed in the project).
I believe that is the core of the question, so closing as a discussion ticket. So feel free to continue discussion here, just closing to indicate a bug fix does not need to be scheduled.
from cajon.
I'm sorry, my description was so vague that I didn't explain myself. I think there's a bug when Cajon reads the dependency list of a module. Here is a minimal complete example.
bower.json
{
"name": "cajon-test",
"dependencies": {
"require-cs": "~0.5.0",
"cajon": "~0.2.4"
}
}
index.html
<html>
<head>
<script src="bower_components/cajon/cajon.js"></script>
<script>
requirejs.config({
paths: {
cs: 'bower_components/require-cs/cs',
'coffee-script': 'bower_components/coffeescript/extras/coffee-script'
},
// Convenient shim for CoffeeScript
shim: { 'coffee-script': { deps: [] } }
});
require(['cs!main']);
</script>
</head>
<body>
</body>
</html>
main.coffee
console.log 'Main'
require 'cs!./dep'
dep.coffee
console.log 'Dep'
If you run this example, you will see Uncaught Error: fromText eval for cs!main failed: Error: Module name "cs!dep" has not been loaded yet for context: _. Use require([])
.
Cajon didn't load dep.coffee before executing main.coffee. If you convert main.coffee to it's JS equivalent, it works just fine.
from cajon.
@jrburke There's an example above that reproduces the problem, if you want to take a look...
Thanks.
from cajon.
Related Issues (15)
- 'use strict' causing script loading errors. HOT 2
- not working with text plugin HOT 9
- "exports is not defined" HOT 2
- Backbone shim HOT 4
- Not working with handlebars via the requirejs-handlebars plugin? HOT 3
- Evaled scripts show up under (no domain) in chrome
- Conditional comments around sourceUrl comment causing grey hair HOT 3
- Code has to be evaluated in global scope HOT 5
- Cajon is not available via Bower HOT 5
- Support require([js-data-uri]); HOT 1
- Cajon treats CoffeeScript compiler as a CommonJS module HOT 1
- Remove Query from path in debugger... HOT 1
- Upgrading from 0.1.14 -> 0.2.4, `global` should be defined HOT 6
- `exportsPropRegExp` should also check for array notation.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cajon.