geelen / react-snapshot

A zero-configuration static pre-renderer for React apps
MIT License
1.66k stars 105 forks source link

chinese characters in url break snapshot #59

Open brandonmp opened 7 years ago

brandonmp commented 7 years ago

One of the routes I have to render has a few chinese chars in it: .../some-route-华安杰/

When snapshot's going thru my routes, it throws on this one with the error below. removing the characters from the path fixes it right up.

/home/bmp/code/admitbrain/node_modules/react-snapshot/lib/snapshot.js:41
        window.react_snapshot_render = function (element, state, rootComponent) {
                                     ^

TypeError: Cannot set property 'react_snapshot_render' of undefined
    at Object.created (/home/bmp/code/admitbrain/node_modules/react-snapshot/lib/snapshot.js:41:38)
    at reportInitError (/home/bmp/code/admitbrain/node_modules/jsdom/lib/jsdom.js:439:12)
    at resourceLoader.download (/home/bmp/code/admitbrain/node_modules/jsdom/lib/jsdom.js:259:9)
    at Request.request [as _callback] (/home/bmp/code/admitbrain/node_modules/jsdom/lib/jsdom/browser/resource-loader.js:208:7)
    at self.callback (/home/bmp/code/admitbrain/node_modules/request/request.js:188:22)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at Request.onRequestError (/home/bmp/code/admitbrain/node_modules/request/request.js:884:8)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admitbrain@0.1.0 build: `cross-env NODE_PATH=src react-scripts build && react-snapshot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the admitbrain@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/bmp/.npm/_logs/
stereobooster commented 6 years ago

What is expected behaviour here? I'm able to get this file structure some-route-%E5%8D%8E%E5%AE%89%E6%9D%B0/index.html