You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Having dependencies in plugin output causes r.js to read non-existent files #463
When I add any dependency to main.coffee (say, 'test', so that line 3 contains require ['test'], ->), r.js will try to read main.js. (This file name depends on the name of the depending file. If I would rename main.coffee to something.coffee, r.js will try to read something.js.)
This is the output:
~/dev/base-web-app % ./build.sh
~/dev/base-web-app/build/work/lib ~/dev/base-web-app
~/dev/base-web-app
Optimizing (standard) CSS file: /Users/zr40/dev/base-web-app/build/minified/css.css
Tracing dependencies for: almond
Error: ENOENT, no such file or directory '/Users/zr40/dev/base-web-app/build/minified/main.js'
In module tree:
cs
Error: Error: ENOENT, no such file or directory '/Users/zr40/dev/base-web-app/build/minified/main.js'
In module tree:
cs
at Object.fs.openSync (fs.js:427:18)
~/dev/base-web-app %
I just tried the sample repo, and it seems to work for me if I create a test.js as a sibling to main.coffee and then do the modification to main.coffee to require it. I also changed the build.js to use
appDir: 'src',
dir: 'build',
instead of the values it had.
What does fail for me is if I change main: 'almond' to main: 'cs!main'. Right now the main module needs to be a .js file, since the output of the build needs to go to a .js file. The optimizer would know know how to write 'cs!main' as a file.
If that was the situation you were hitting, then I will use this ticket to put in a config check to give a better warning of the problem.
OK, so the issue is that you specify 'anything' as a dependency in main.coffee but that errors out with the error about main.js, but really the error is about a missing anything.js I will put this in the 2.1.7 to see why the error does not report about the missing anything.js.
If I put anything.js in the directory with main.coffee, then the build completes.
Tracing this a bit more: the error is correctly reported for 'no such file' for anything.js when the include: is for 'foo' instead of 'cs!main' so something with the plugin call swallows the error with 'anything', which does get triggered, but just gets lost. Going to push this to 2.2.0, since some other changes around plugins and their resources are scheduled, and I think a fix for this will fall out of those changes.
Activity
jrburke commentedon Jun 11, 2013
I just tried the sample repo, and it seems to work for me if I create a test.js as a sibling to main.coffee and then do the modification to main.coffee to require it. I also changed the build.js to use
appDir: 'src',
dir: 'build',
instead of the values it had.
What does fail for me is if I change
main: 'almond'tomain: 'cs!main'. Right now the main module needs to be a .js file, since the output of the build needs to go to a .js file. The optimizer would know know how to write 'cs!main' as a file.If that was the situation you were hitting, then I will use this ticket to put in a config check to give a better warning of the problem.
jrburke commentedon Jun 11, 2013
OK, so the issue is that you specify 'anything' as a dependency in main.coffee but that errors out with the error about main.js, but really the error is about a missing anything.js I will put this in the 2.1.7 to see why the error does not report about the missing anything.js.
If I put anything.js in the directory with main.coffee, then the build completes.
jrburke commentedon Jul 7, 2013
Tracing this a bit more: the error is correctly reported for 'no such file' for anything.js when the include: is for 'foo' instead of 'cs!main' so something with the plugin call swallows the error with 'anything', which does get triggered, but just gets lost. Going to push this to 2.2.0, since some other changes around plugins and their resources are scheduled, and I think a fix for this will fall out of those changes.