Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

window is not defined with SSR on next branch #92

Open
billwing opened this issue Aug 3, 2017 · 8 comments
Open

window is not defined with SSR on next branch #92

billwing opened this issue Aug 3, 2017 · 8 comments

Comments

@billwing
Copy link

billwing commented Aug 3, 2017

I do it like Server-Side Rendering (SSR), but not work:

 ReferenceError: window is not defined
@piyushchauhan2011
Copy link

I would recommend using this library instead vue-touch-events @billwing

@billwing
Copy link
Author

@piyushchauhan2011 OK, thanks. I have a try later.

@PengXing
Copy link

@billwing I followed this document, and problem resolved. Help it be useful.

@billwing
Copy link
Author

@PengXing I do like that but not work, and same problem:

webpack.server.config.js:
image

hammer-ssr.js:

export default class Hammer {}

@Kaptard
Copy link

Kaptard commented Sep 19, 2017

I made a small PR concernig this issue. Until it's merged, you can use it via npm install vue-touch-hotfix. Works the same as vue-touch, except no errors server-sided. (No webpack adjustments required either)

@PengXing
Copy link

PengXing commented Sep 19, 2017

@billwing you need add hammerjs to the nodeExternals whitelist, or your SSR will still use the hammerjs from node_modules.

// webpack.server.conf.js
externals: nodeExternals({
    whitelist: [/\.(css|vue)$/, /hammerjs/]
})

@Linzdigr
Copy link

Linzdigr commented Nov 29, 2017

The @Kaptard 's solution is the only workaround working for me

@dr1v3
Copy link

dr1v3 commented Feb 23, 2018

@Kaptard thanks a lot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants