-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Use the global RequireJS config for ExtensionLoader. Fixes #1087 #12041
Conversation
I find a bit weak to rely on the semi-private API and the discussion linked above seems quite old. |
@ficristo It's the only way if you want to use the same configuration over different domains (for example extensions, web workers and node domains): it's a limitation of It isn't a very meaningful change as of now: everything will work as they used to. It's a blocker for something similar to #12006 (my |
Thank you for the clarification. |
// Convert the relative paths to absolute | ||
Object.keys(globalPaths).forEach(function (key) { | ||
globalPaths[key] = PathUtils.makePathAbsolute(srcPath + "/" + globalPaths[key]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope not, but if we'll find problems with this approach we'll have to dupe again this configuration:
Line 29 in bf9b07d
paths: { |
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ficristo, yup. There shouldn't be any problems with the approach however.
Signed-off-by: petetnt <[email protected]>
00767ab
to
fb60e92
Compare
Updated this PR against the latest master (non-global PathUtils), prefixed the API and made a note about internal use only. |
@@ -41,7 +41,8 @@ define(function (require, exports, module) { | |||
FileUtils = require("file/FileUtils"), | |||
Async = require("utils/Async"), | |||
ExtensionUtils = require("utils/ExtensionUtils"), | |||
UrlParams = require("utils/UrlParams").UrlParams; | |||
UrlParams = require("utils/UrlParams").UrlParams, | |||
PathUtils = require("thirdparty/path-utils/path-utils"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small indentation issue here.
Do you have tryed it with an installer? |
Signed-off-by: petetnt <[email protected]>
Signed-off-by: petetnt <[email protected]>
Fixed the indentation issue and added a missing piece from the original fix that had gone missing after rebasing. Haven't tried it with installer, but extensions seem to load and install just fine. |
I tryed with a custom build installer on Linux (Ubuntu) and the TODO extension worked. |
Brackets has a long running (minor) issue #1087, where the global RequireJS path configuration is not being re-used but instead repeated in
ExtensionLoader.js
.This PR fixes the issue by creating a simple wrapper API around the semi-private (see James Burkes comment here)
requirejs.s.contexts._.config
and later converts them to absolute paths inExtensionLoader.js
.This same method can also be used to retrieve global modules with other modules that aren't run in the same scope as the rest of Brackets, such as WebWorkers and Node instances. For more information see my comment at: #12006 (comment)