Works find in action.js file 1, but the project won't compile when trying to use the module in another file
Hi there,
I am building a react flux project using Node: v4.4.4, "react": "^15.3.2", "react-dom": "^15.0.1", "flux": "2.0.1",
I added the line ( import noCache from 'uperagent-no-cache';) in one of my action.js file
Worked great! But every time I try to put the EXACT SAME import statement in another action.js file, the project won't compile.
Got an error node_modules/superagent-no-cache/node_modules/component-ie/index.js:16 el = document.createElement('b'), ^
ReferenceError: document is not defined
Does anyone has any clue why this is happening?
I am not sure whether this is the best solution, but after changing "import noCache from 'superagent-no-cache';" to
"var isBrowser = typeof window !== 'undefined'; "var noCache = isBrowser ? require(‘superagent') : undefined;"
It worked.
The reason it broke is similar to issue #10 . Node environment does not have "ie", thus I added the ternary expression.
@injune1123 I believe #23 should solve this problem. Do you agree?