-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve module react-dom/server
from `/...[path to your user folder]/...[project]/node_modules/react-localize-redux/lib/Translate.js
#73
Comments
I will have to look into this as I would need to investigate whether there is a third-party library that accomplishes the same as |
Any solution for this issue? The version of localize library has not changed, but after running a npm install I got this issue. It's very bad that there's a breaking change without a version change. Very disappointing. |
@husni1992 while I understand your frustration I myself have never done any development in React Native, or claimed this library would work out of the box with it. Unfortunately the latest changes in Unfortunately I don't have much bandwidth to look into this issue right now. For now I suggest downgrade to |
@husni1992 @juanjoslopezv I have developed a work around for this issue that will be available in the next major release, which you can read about here (Moving to v3 #67). Unfortunately I could not find a viable option to replace react-dom's
import { renderToStaticMarkup } from 'react-dom/server';
// for react in browser
this.props.initialize({
languages: [
{ name: 'English', code: 'en' },
{ name: 'French', code: 'fr' },
],
options: { renderToStaticMarkup }
}); // for react native
this.props.initialize({
languages: [
{ name: 'English', code: 'en' },
{ name: 'French', code: 'fr' },
],
options: { renderToStaticMarkup: false }
}); The one caveat being is that React Native users would not be able to include inline default translations that contain HTML to Translate. This is where the // this won't work for React Native
<Translate>
<p>Here is a <strong>default</strong> translation with some HTML</p>
</Translate> |
although this did cost me several hours of frustration, great work man, appreciate you still maintaining the project! |
@Medardas it should be ready soon. I'm just working on creating the migration guide, and ironing out a few things with the type definitions. If you like I've just published the latest release candidate that contains the fix discussed in my previous comment. I have also updated the v3 doc with this info as well. To install:
Updated docs: https://ryandrewjohnson.github.io/react-localize-redux-docs/#initialize |
Issue has been fixed in v3.0.0 release. See Can I use React Native? for details. |
When using this library in a React Native app its not able to compile due to the fact that React-Dom is not available for a React Native App.
Commenting out these lines in:
lib/Translate.js
14 // var _server = require('react-dom/server');
15
16 // var _server2 = _interopRequireDefault(_server);
.
.
.
118 // var translation = _server2.default.renderToStaticMarkup(children);
119 // var defaultLanguage = locale.options.defaultLanguage || locale.languages[0].code;
120 // store.dispatch((0, _locale.addTranslationForLanguage)(_defineProperty({}, id, translation), defaultLanguage));
Allows you to compile and use it properly
The text was updated successfully, but these errors were encountered: