-
Notifications
You must be signed in to change notification settings - Fork 14
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
decor/schedule should be loadable during the build. #45
Comments
Thanks @clmath for elaborating what the problem is.
This leads to a bigger problem than access to Given feature detection and branching upon its result is one of the key use cases for has.js, I’d suggest fixing the build system therefore. |
Updated my change introducing |
I don't think we should bloat the code with support for non-browser non-Node (or old Node) environments. No one will ever use that code branch. IIUC we can work around this weirdness with the build system by simply changing: } else if (!has("setimmediate-api")) { to } else if (!has("setimmediate-api") && typeof window !== "undefined") { (like you did at asudoh@9d92fe4#diff-13ae235e4b68af8228369014f462fd2bR50) |
PS: About the build system, I agree it's confusing to not execute |
I thought the build system loads code in two different ways? One is for inclusion in layers where no code runs and |
BTW basically I don’t think it would make sense to introduce a workaround specifically for our specific build system. |
IIUC, as you said, the build system needs to execute the code in plugins, specifically
I don't know any other way to solve the problem. FWIW, I did think of many other workarounds though. if (has("mutation-observer-api")) {
pseudoDiv.id = 0;
new MutationObserver(runCallbacks).observe(pseudoDiv, {attributes: true});
} else if (!has("setimmediate-api")) {
window.addEventListener("message", function (event) {
if (event.data === uniqueId) {
runCallbacks();
}
});
} So some other workarounds are:
|
My point was that the environment running In this context, if we set |
Can't we be pragmatic? We have very little time for that right now. We have a one word workaround for schedule.js and we would have a day of work to adapt the build system. So what about for this release implementing the workaround and registering an issue on requirejs-dplugins/has so that later we can implement the proper solution? |
If it's only a day of work to fix the build system then I would go for that. |
@wkeese If you have it, feel free to do it, but we don't :( |
@wkeese @clmath Just to double-check, my interpretation of #45 (comment) is |
+1 for not maintaining the builder by our own. I heard it’s for some of our plugins, but I think we should minimize what our builder code does at least. Probably amodro-trace would help on that. |
|
Thanks @clmath for your feedback, let's go for 1. in #45 (comment) for now then. |
I created the issue against requirejs-dplugins/has. ibm-js/requirejs-dplugins#22 |
This issue is the follow up of ibm-js/delite#402
@asudoh said:
Actually I am using node v0.10.33. I have checked and
setImmediate()
is available.The problem is that the
has
plugin is set to not execute feature tests during the build since they could lead to incorrect modules inclusion in the layer.So
has("setImmediate")
is always false during the build even on node v0.10.33.So maybe a quick fix can be to have a
typeof window !== "undefined"
check before accessing window.The text was updated successfully, but these errors were encountered: