New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module or package specific configuration (with config overrides) #219
Comments
Can you elaborate? This feature works fine in my tests. curl.config({ packages: [{ name: 'bar', location: 'foo', main: 'core', config: {foo:1} }] });
//... later, in a module in the bar package:
var cfg = module.config ? module.config() : {};
var foo = cfg.foo; |
A bit time-consuming to set up a proper test case, but I will if needed. If I put a |
Interesting. That's the opposite of what I would have expected. As a work-around until I test this, you could try something like the following if there is only one module that needs curl.config({
paths: {
'core/module-that-needs-config': { location: 'core/module-that-needs-config', config: { foo: 1 } }
}
}); |
Thanks for the work-around, that works fine. Obviously I'm interested in a possible fix. |
Yes. Let's keep this issue open until I have a chance to look into the problem further. :) |
I've been grappling with similar: Specifically, curl package will not use paths:{} not defined in the original config object. This, taken from my bootstrapping config.js.config.js has no effect: {
name: 'MyPkg',
location: 'path/to/templates',
main: 'js/my-package.source',
// config options specific to MyPkg
config: {
paths: {
foo: 'path/to/foo',
bootstrap: 'sample/path/to/bootstrap.js'
}
}
} ...and doing this in the above package module throws error (see below) curl.config({
paths: {
bootstrap: 'path/to/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js'
}
});
define(['firstPkg', 'some/js/module.source', 'js!bootstrap'], function(exposure1, exposure2) {
// sidenote: module property is not available here in a package 'module'?
return exposure1;
}); Error thrown: // adds the path matching regexp onto the cfg or plugin cfgs.
function convertPathMatcher (cfg) {
var pathMap = cfg.pathMap;
cfg.pathRx = new RegExp('^(' +
cfg.pathList.sort(function (a, b) { return pathMap[b].specificity - pathMap[a].specificity; } )
X Uncaught TypeError: Cannot read property 'specificity' of undefined
.join('|')
.replace(/\/|\./g, '\\$&') +
')(?=\\/|$)'
);
delete cfg.pathList;
} To be clear, defining the 'bootstrap' path in the paths hash of the mentioned bootstrapping config.js works fine. |
Hey @CNSKnight, I think it's highly unlikely that curl will offer per-package At the moment, we're spending most of our module-focused efforts on rave. Rave already handles per-package mappings automatically (without configuration). Yes, rave is still under development, but it sounds like you have a work-around that you can use for now? I'm going to close this issue, but please keep posting if you need additional help on your work-around. Regards, -- John |
Gotit. Meantime, let's update the docs to to that effect. Best |
Done: 38fbed6 |
How can I add module-specific configuration with curl? E.g.
packages: [{ name: 'bar', location: 'foo', main: 'core', config: {foo:1} }]
.This completely confuses curl it seems. The "proposed standard" way also doesn't seem to work (https://github.com/amdjs/amdjs-api/wiki/Common-Config#config-).
I can request
module.config()
in a module, yet I don't know how to add data in the main config.The text was updated successfully, but these errors were encountered: