-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require-CS not working with Cajon #13
Comments
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. |
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 Cajon didn't load dep.coffee before executing main.coffee. If you convert main.coffee to it's JS equivalent, it works just fine. |
@jrburke There's an example above that reproduces the problem, if you want to take a look... Thanks. |
Is it possible that Cajon doesn't use the cs! plugin to parse a .coffee file before reading it's dependencies?
The text was updated successfully, but these errors were encountered: