Reputation: 99
When I try to run full-icu
with nodemon
, it doesn't add the localization support as expected.
I've tried to include full-icu
via an environment variable, which I load with dotenv
, then via CLI, none had worked yet. I'm running Node.js 12.3.1, nodemon 1.19.1, full-icu 1.3.0.
CLI:
const gulp = require('gulp');
const {spawn} = require('child_process');
gulp.task('nodemon', () =>
{
const {stdout, stderr} = spawn('nodemon.cmd', ['--icu-data-dir=/node_modules/full-icu']);
//...
});
.env:
NODE_ICU_DATA=/node_modules/full-icu
Also, I've tried to remove the first slash or include the absolute path without any success.
When I run:
console.log(Intl.NumberFormat.supportedLocalesOf('sk');
The output should be ['sk']
, but is actually []
for any language other than English.
Upvotes: 1
Views: 2899
Reputation: 99
I've solved it by changing "start"
in "scripts"
in package.json
from:
"scripts": {
"start": "node ./app"
}
to:
"scripts": {
"start": "node --icu-data-dir=node_modules/full-icu ./app"
}
The problem with the CLI was probably a wrong order of the variables because --icu-data-dir
was preceded by ./app
. And I guess the problem with the environment variable was that I'd added it after the initialization of the process and Node didn't check it afterwards. If that's not the case, I'd like to be corrected.
Upvotes: 1