trueadm / t7

Lightweight virtual DOM templating library
900 stars 31 forks source link

it have something wrong with nwjs when 'require("t7")' #21

Open seasonwarm opened 8 years ago

seasonwarm commented 8 years ago

it have something wrong with react、nwjs when 'require("t7")'; wrong: .\node_modules\t7\t7.js:818 Uncaught TypeError: t7._cache[templateKey] is not a function

i think: //we store created functions in the cache (key is the template string); var isBrowser = typeof window != "undefined" && document != null when browser isBrowser is true when node isBrowser is false (i did't test) but when nwjs and require a js file,isBrowser is true i think isBrowser should be false

it maybe just differenct from require or <script src=''> 2 reference methods

oh it maybe wrong about my think,but i hope it can run on nwjs(require) soon

thank you

trueadm commented 7 years ago

@seasonwarm sorry for taking absolutely ages to get back to you – I have no idea why I never saw the notification for this. It sounds like you're using something that adds a global window variable? I'm not too familiar with nwjs but I'd maybe ask why this is the case? Are they using jsdom or some other library that adds to globals?

davemackintosh commented 7 years ago

nwjs and Electron both add require to the global space which is why this causes issues. It also adds module IIRC.

I'll try to get a PR in for a more accurate check on these platforms in a few days. I'm using it in Electron too so will come into this issue soon enough.

trueadm commented 7 years ago

@davemackintosh Thank you! Also, would you mind jumping onto the Inferno slack? https://inferno-slack.herokuapp.com/ It's also the home of t7 :)

davemackintosh commented 7 years ago

Sure thing bud

On 15 Jan 2017 6:04 p.m., Dominic Gannaway notifications@github.com wrote:

@davemackintoshhttps://github.com/davemackintosh Thank you! Also, would you mind jumping onto the Inferno slack? https://inferno-slack.herokuapp.com/ It's also the home of t7 :)

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/trueadm/t7/issues/21#issuecomment-272712134, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABXUgXMrbzLXn5LzQpRM0zoduthmq3Jyks5rSl-ngaJpZM4I-elG.