SeoulSoul
SeoulSoul

Reputation: 79

Asking npm cli for react-intl library when doing message extraction

I am new to npm script and react-intl. In our current project, npm script for react-intl is defined like the following way on package.json to do the message extraction.

{ 
"script": {
 "extract": "formatjs extract -- 'src/**/*.ts*' --ignore='**/*.d.ts' --out-file src/resources/languages/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'",
 }
}

But when I run npm run extract, it throws an error message.

enter image description here

To fix this issue, I read through the documentation and modified the script on package.json.

{ 
"script": {
 "extract": "formatjs extract",
 }
}

When I executed, npm run extract -- 'src/**/*.ts*' --ignore='**/*.d.ts' --out-file src/resources/languages/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'" works. It extracted messages successfully.

Could someone explains me why the first method is failing whereas the second works?

Upvotes: 0

Views: 31

Answers (0)

Related Questions