Js-lingui: lingui doesn't work in Node.js

Created on 4 Sep 2017  路  5Comments  路  Source: lingui/js-lingui

Hey,

if I try to use lingui in a SSR environment and I'll get an exception, because lingui-formats directly accesses the window-object, which doesn't exist in a node-environment.

Trace:

ReferenceError: window is not defined
at Object. (/Users/bb/Development/xxx/src/node_modules/lingui-formats/dist/index.js:5:24)
at Module._compile (module.js:573:30)
at Module._extensions..js (module.js:584:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/bb/Development/xxxx/src/node_modules/babel-register/lib/node.js:152:7)

Is SSR simply not supported at the moment, is it a bug or am I missing something?

馃悶bug

All 5 comments

You're right, SSR isn't tested at the moment. However, I would consider it as a bug, because Intl object is present in Node.js. Interested in sending PR? This looks like a quick fix.

Sure - You'll get the pull in a few minutes.

Done, see #76

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ppozniak picture ppozniak  路  4Comments

zdzarsky picture zdzarsky  路  5Comments

LFDMR picture LFDMR  路  4Comments

charliedavison picture charliedavison  路  3Comments

ludwigbacklund picture ludwigbacklund  路  6Comments