Skip to content

Circular Dependencies with cs plugin don't work well. #13

Description

@hisayan

ref http://requirejs.org/docs/api.html#circular and https://github.com/jrburke/requirejs/tree/master/tests

# onecs.coffee
define [ "require", "cs!twocs" ], (require, two) ->
  console.log two
  one = 
    size: "large"
    doSomething: ->
      require "cs!twocs"

  one
# twocs.coffee
define [ "require", "cs!onecs" ], (require, one) ->
  console.log one
  size: "small"
  color: "redtwo"
  doSomething: ->
    require("onecs").doSomething()
# circular-tests-cs.js
require({
        baseUrl: "./"
    },
    ["require", "cs!twocs"],
    function(require, two) {
        var args = two.doSomething();
        doh.register(
            "circular",
            [
                function circular(t) {
                    t.is("small", args.size);
                    t.is("redtwo", args.color);
                }
            ]
        );
        doh.run();
    }
);
#circular-cs.html
<!DOCTYPE html>
<html>
<head>
    <title>require.js: Circular Test</title>
    <script type="text/javascript" src="../require.js"></script>
    <script type="text/javascript" src="doh/runner.js"></script>
    <script type="text/javascript" src="doh/_browserRunner.js"></script>
    <script type="text/javascript" src="circular-tests-cs.js"></script>
</head>
<body>
    <h1>require.js: Circular Test</h1>
    <p>Check console for messages</p>
</body>
</html>

Uncaught Error: Load timeout for modules: cs!twocs cs!onecs

What should I do ?

my English is not good.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions