-
Notifications
You must be signed in to change notification settings - Fork 670
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
r.js build fails when trying to evaluate a plugin that shouldn't be evaluated #972
Comments
Loader plugins participate in the r.js tracing, so that loader-dependent modules can be inlined in bundles. To fix, the plugin's define({
load: function(na, require, onload, config) {
// Running in r.js, just inform the loader this load is finished,
// does not need a real module value in the r.js build case.
if (typeof window === 'undefined') {
onload();
}
if (window.location.search.indexOf('webgl') > 0 &&
window.location.search.indexOf('webgl=false' < 0)) {
map = "luciad/view/WebGLMap";
} else {
map = "luciad/view/Map";
}
require([map], function(value) {
onload(value);
});
}
}); If you wanted to include both Closing as a discussion ticket, but feel free to continue discussion here. |
Thanks a lot for your swift answer. The following code - which is based on your answer - seems to do the trick :
There's another issue that I'm struggling with, though... |
I have an AMD plugin named
MapLoader
.When importing
samples/template/MapLoader!
, this will either return the moduleluciad/view/Map
or the moduleluciad/view/WebGLMap
, depending on the URL query parameter "webgl".Here's the code of the plugin :
Now, I'm trying to use r.js to pack my project, but it doesn't know how to deal with this module, because it tries to evaluate the code. Hence, it produces the following error :
My current config looks like this :
What am I missing?
What is the correct way to add this plugin to my build?
The text was updated successfully, but these errors were encountered: