Jade-runtime breaks almond
pateketrueke opened this issue · 3 comments
I'm using almond by first time, everything is right but your "deps is undefined" isn't working as I expected.
Specifically I can't change the jade-runtime (even other) code since its installed through bower, so, I changed this line on almond and everything is working properly.
if (deps && !deps.splice) {
What can I do?
I think this checking is necessary, I can't spend time thinking about how hacking this on my remote building/CI process.
That error indicates that concatenation did not work correctly, and there is an anonymous define() in the build output. If you are using r.js to do the bundling this should not normally happen, as it names define() calls as they are concatenated, although there is always a chance r.js has a bug. But if you are doing your own concatenation, that is likely the problem.
If you are using r.js, it would be good to have a test case or example of the build output to inspect.
While that code change you mention avoids that immediate error, it likely just hides a larger issue that needs to be solved, and could mean you will get subtle errors later during runtime.
I'm not using r.js still, i'm working locally and just by including jade-runtime.js after almond.js breaks everything.
The jade-runtime.js comes with "pre-optimized/compiled" version for work with or without (?) any require-js implementation, thus the problem is coming from jade (?).
Do you think that r.j solves this?
It should be able to solve it. The define() calls need to have IDs inserted during concatenation though for almond (or any module concatenation) to work correctly. See restrictions section:
https://github.com/jrburke/almond#restrictions
Closing for now, but we can reopen if r.js does not fix it.