Running yarn messages on Intl branch gives following error:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string
@kayluhb created an issue here: https://github.com/yahoo/babel-plugin-react-intl/issues/135
OK, I think I have a solution (added filename: fileName, line):
file: tools/messages.js:
const processFile = async fileName => {
try {
const code = await readFile(fileName);
const posixName = posixPath(fileName);
const result = transform(code, {
filename: fileName,
presets: babelrc.presets,
plugins: ['react-intl'],
}).metadata['react-intl'];
if (result.messages && result.messages.length) {
fileToMessages[posixName] = result.messages.sort(compareMessages);
} else {
delete fileToMessages[posixName];
}
} catch (err) {
console.error(`extractMessages: In ${fileName}:\n`, err.codeFrame || err);
}
};
What should I do for this to be fixed? Code above?
@langpavel Adding the line filename: fileName as option for transform() method made it work in my case.
Most helpful comment
@langpavel Adding the line
filename: fileNameas option fortransform()method made it work in my case.