admin管理员组文章数量:1279055
When using Create React App and TypeScript, a file is auto-generated in the src
directory: react-app-env.d.ts
. This file seems necessary to support image imports as discussed here: .
When using Format.JS, I extract messages using the following mand:
yarn extract 'src/**/*.ts*' --out-file lang/en-GB.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'
But unfortunately this results in this error:
warning Error: Error processing file src/react-app-env.d.ts
Debug Failure. Output generation failed
Done in 9.64s.
I need to process both .ts and .tsx files. I have tried to hack the search pattern to exclude the specific file name, but I am now pletely stumped as I am unsure of its precise specification.
As a workaround I can delete the file prior to extraction, but this is very annoying!
When using Create React App and TypeScript, a file is auto-generated in the src
directory: react-app-env.d.ts
. This file seems necessary to support image imports as discussed here: https://github./facebook/create-react-app/issues/6560.
When using Format.JS, I extract messages using the following mand:
yarn extract 'src/**/*.ts*' --out-file lang/en-GB.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'
But unfortunately this results in this error:
warning Error: Error processing file src/react-app-env.d.ts
Debug Failure. Output generation failed
Done in 9.64s.
I need to process both .ts and .tsx files. I have tried to hack the search pattern to exclude the specific file name, but I am now pletely stumped as I am unsure of its precise specification.
As a workaround I can delete the file prior to extraction, but this is very annoying!
Share Improve this question asked Jun 25, 2021 at 11:19 PJRobotPJRobot 1,41614 silver badges15 bronze badges2 Answers
Reset to default 15Just use 'src/**/!(*.d).ts*'
pattern in your extract script, this will exclude all .d.* files from your src folder.
You can also do formatjs extract --ignore='**/*.d.ts'
.
This is a good search https://github./search?l=JSON&q=%22formatjs+extract%22&type=Code if you're curious about usages.
I threw in a PR to update the documentation.
本文标签: javascriptIgnoring specific file path during FormatJs message extractionStack Overflow
版权声明:本文标题:javascript - Ignoring specific file path during Format.Js message extraction - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741303471a2371230.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论