Identification if running on server or client lacks of assumption.
debrutal opened this issue · comments
The current code to identify on which environment the application is running among other things is deferred by the existence of a module.
This is not necessarily true, especially if you use a packaging system like webpack, which uses modules on the client side.
Are there any plans to use another indicator?
File reference
Refering to the line 5 in bucky.js
isServer = (typeof module !== "undefined" && module !== null) && !(typeof window !== "undefined" && window !== null ? window.module : void 0);
We don't have specific plans for an update -- PRs are welcome, though, if you have a suggestion/proposal.
Hi,
since i was not confident enough in the past to open a PR for this and i don't have access to the code anymore i can just recall my activities from 2015.
!(typeof window !== "undefined" && window !== null ? window.module : void 0)
By removing the check for a module system, since we can have module system on the client side the part should look like this:
(typeof window !== "undefined" && window !== null );
I think that's all we did for our usecase.
I solved that problem with webpack configuration
new webpack.DefinePlugin({ 'window.module': 'module', });
Unfortunately i cannot confirm this. It has been too long ago. If it's ok, i would close this since there are existing solutions.