cngu / vue-typer

Vue component that simulates a user typing, selecting, and erasing text.
https://cngu.github.io/vue-typer
MIT License
792 stars 51 forks source link

window is not defined error when used with SSR #1

Open judocode opened 7 years ago

judocode commented 7 years ago

I tried to use vue-typer with Vue hackernews 2.0 (which uses SSR), and I get an error from vue-typer when attempting to import it:


    at C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:4714
    at C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:4646
    at t.exports (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:5075)
    at Object.t.__esModule.default (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:18984)
    at e (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:320)
    at Object.t.__esModule.default (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:5506)
    at e (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:320)
    at Object.<anonymous> (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:19176)
    at e (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:320)
    at t.exports.version (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:703)
    at C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:713
    at n.(anonymous function).i (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:81)
    at Object.<anonymous> (C:\Code\justus\node_modules\vue-typer\dist\vue-typer.min.js:6:197)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)```
cngu commented 7 years ago

I have 0 experience in SSR, and am quite new to the Vue ecosystem, so I could use some help with this one.

I've spent some time investigating this and the issue is how vue-typer's CSS is being loaded. Here is a summary of what is going on: