cjs
cjs copied to clipboard
Error: Explicit require of module is not allowed.
I'm trying to put together the simplest example I can, and having a problem.
This is my main.js:
require.config({
paths: {
"amd-loader": "node_modules/amd-loader/amd-loader"
}
});
require(["cjs!test"], function (test) {
console.log(test.out);
});
And this is test.js:
exports.out="hi";
If I try to run r.js on main, I get:
Error: Error: Explicit require of module is not allowed.
In module tree:
main
cjs
Any idea why?
This project hasn't been maintained for over a year so it may have drifted out of date with RequireJS updates. I have no idea of that error message - it was not in the previous versions of require.
I guess the issue happens on this line https://github.com/guybedford/amd-loader/blob/master/amd-loader.js#L30. If you work it out please let me know. Sorry I can't be of more help than this... perhaps consider using SystemJS.
Thanks for the reply. While I was looking around on GitHub issues I also noticed that you have moved your efforts to the System plugin. It might be a good idea to make a note that the plugin is deprecated in favor of System on the RequireJS list of plugins on GitHub. Would save you from having to deal with people filing more issues :)
Thanks again!
-Jeff
On Nov 17, 2014, at 8:31 AM, Guy Bedford [email protected] wrote:
This project hasn't been maintained for over a year so it may have drifted out of date with RequireJS updates. I have no idea of that error message - it was not in the previous versions of require.
I guess the issue happens on this line https://github.com/guybedford/amd-loader/blob/master/amd-loader.js#L30 https://github.com/guybedford/amd-loader/blob/master/amd-loader.js#L30. If you work it out please let me know. Sorry I can't be of more help than this... perhaps consider using SystemJS.
— Reply to this email directly or view it on GitHub https://github.com/guybedford/cjs/issues/3#issuecomment-63304445.
I don't see any require config path for cjs itself.
For me the problem was that amd-loader is other plugin in bower/npm registry - amd-loader git://github.com/ajaxorg/node-amd-loader.git - if you installed amd-module via bower or npm it can be also your issue