Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

config not passed to r.js #197

Open
Rush opened this issue Oct 22, 2014 · 6 comments
Open

config not passed to r.js #197

Rush opened this issue Oct 22, 2014 · 6 comments

Comments

@Rush
Copy link

Rush commented Oct 22, 2014

I have set up a shim config for my application in config/requirejs.yml, such as:

shim: 
  jquery:
    exports: 'jQuery'
  jquery_ujs:
    deps: ['jquery']
  'bootstrap': ['jquery', 'jquery_ujs']
  'twitter/bootstrap/rails/confirm':
    deps: ['bootstrap', 'jquery_ujs']
  'novnc/rfb':
    deps: ["novnc/util","novnc/webutil", "novnc/base64", "novnc/websock", "novnc/des",
        "novnc/keysymdef", "novnc/keyboard", "novnc/input", "novnc/display", "novnc/jsunzip"]
  'novnc':
    deps: ['novnc/rfb']
    exports: 'RFB'
modules:
  - name: 'application'
wrapShim: true

but I am not seeing those options passed to r.js, file tmp/requirejs/rjs_driver.js contains:

var requirejs = require("/home/rush/.rvm/gems/ruby-2.1.3/gems/requirejs-rails-0.9.5/bin/r.js")
var baseConfig = {
  "baseUrl": "/home/rush/virtkick/webapp/tmp/requirejs/src",
  "dir": "/home/rush/virtkick/webapp/tmp/requirejs/dst"
};

baseConfig.modules = [
  {
  "name": "application"
},
];

What is wrong, is this application bug? How can I make the build_config to be loaded?

@carsomyr
Copy link
Collaborator

@RushPL Looks like the failure is with wrapShim, which is fixed with PR #193. Will merge once I get around to it. Let me know if this isn't your problem, and I'll reopen.

@Rush
Copy link
Author

Rush commented Oct 22, 2014

Yeah .. wrapShim is one thing, but shouldn't shim deps be passed to r.js as well? Wrap shim is gonna wrap them but it needs the actual dependencies to actually the code in wrapped blocks, if you know what I'm saying.

@Rush
Copy link
Author

Rush commented Oct 22, 2014

I think it's both shim and wrapShim that need to be passed to it in order to work.

I checked manually by running:
node tmp/requirejs/rjs_driver.js

If I manually make the config mention my dependencies, it works properly:

var requirejs = require("/home/rush/.rvm/gems/ruby-2.1.3/gems/requirejs-rails-0.9.5/bin/r.js")
var baseConfig = {
  "baseUrl": "/home/rush/virtkick/webapp/tmp/requirejs/src",
  "optimize": "none",
  "wrapShim": "true",
  "dir": "/home/rush/virtkick/webapp/tmp/requirejs/dst",
  "shim": {
    "jquery": {
      "exports": "jQuery"
    },
    "jquery_ujs": {
      "deps": [
        "jquery"
      ]
    },
    "bootstrap": [
      "jquery",
      "jquery_ujs"
    ],
    "twitter/bootstrap/rails/confirm": {
      "deps": [
        "bootstrap",
        "jquery_ujs"
      ]
    },
    "novnc/rfb": {
      "deps": [
        "novnc/util",
        "novnc/webutil",
        "novnc/base64",
        "novnc/websock",
        "novnc/des",
        "novnc/keysymdef",
        "novnc/keyboard",
        "novnc/input",
        "novnc/display",
        "novnc/jsunzip"
      ]
    },
    "novnc": {
      "deps": [
        "novnc/rfb"
      ],
      "exports": "RFB"
    }
  }
};

baseConfig.modules = [
  {
  "name": "application"
},
];

requirejs.optimize(baseConfig);

Please reopen the issue.

@ianwalter
Copy link

+1
Shim deps don't work.

@arfl
Copy link

arfl commented Feb 3, 2016

+1

@carsomyr
Copy link
Collaborator

carsomyr commented Feb 8, 2016

Thanks for the reports guys. I'm going to be looking into this in the upcoming week.

@carsomyr carsomyr reopened this Feb 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants