Zod- / jsVideoUrlParser

A javascript parser to extract informations like provider, channel, id, start time from YouTube, Vimeo, Dailymotion, Twitch,... urls
MIT License
234 stars 73 forks source link

ReferenceError: window is not defined #29

Closed alexhung closed 7 years ago

alexhung commented 7 years ago

Install via npm, open node REPL and got this when trying to require the lib:

ReferenceError: window is not defined
    at Object.<anonymous> (/Volumes/Data/Users/.../node_modules/js-video-url-parser/dist/jsVideoUrlParser.js:775:4)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at repl:1:17
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:287:14)

Same error when I use it in my node project.

Zod- commented 7 years ago

Shouldn't it just pass it as undefined when window is not defined? })(window); I'm doing a nil check later on, didn't really expect this to break.

Zod- commented 7 years ago

@alexhung could you give it a try with these changes.

StephanGeorg commented 7 years ago

Yes, this works. Would you please submit it to npm?

Zod- commented 7 years ago

Oh man I totally forgot to actually publish it. Sorry about that.