Skip to content

Having dependencies in plugin output causes r.js to read non-existent files #463

Open

Description

My base web app template (https://github.com/zr40/base-web-app) contains a single CoffeeScript source file (main.coffee) without dependencies. build.sh invokes r.js -o build.js, and this succeeds.

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 %

Activity

  1. jrburke commented on Jun 11, 2013

    @jrburke
    Member

    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.

  2. jrburke commented on Jun 11, 2013

    @jrburke
    Member

    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.

  3. jrburke commented on Jul 7, 2013

    @jrburke
    Member

    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.

  4. modified the milestones: 2.2.0, 3.0 on Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions