localized-strings icon indicating copy to clipboard operation
localized-strings copied to clipboard

NodeJS

Open LivioGama opened this issue 6 years ago • 5 comments

Is it possible to use with NodeJS? So far when I try, I get the error : const key = new LocalizedStrings({ ^

TypeError: LocalizedStrings is not a constructor

LivioGama avatar Sep 19 '18 15:09 LivioGama

I guess you should use a transpiler like Babel.

stefalda avatar Sep 19 '18 18:09 stefalda

Hello, Thanks for your reply. I'm not an expert in transpiler, could you please guide me in the process of making it work with Babel ?

LivioGama avatar Sep 20 '18 07:09 LivioGama

@LivioGama are you using require() ??? try with .default

const LocalizedStrings = require('localized-strings').default;

fbacker avatar Sep 28 '18 12:09 fbacker

Hi, this issue still remains when using ES6 any updates guys?

import LocalizedStrings from 'localized-strings';
let strings = new LocalizedStrings(
{                       ^
TypeError: LocalizedStrings is not a constructor

RMcode avatar Mar 20 '23 15:03 RMcode

This seems to work for ES6 -

const strings = new LocalizedStrings.default( { .....

EedenBull avatar Mar 20 '23 16:03 EedenBull