-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module '@lingui/message-utils/compileMessage' #1633
Comments
Getting this error too for React Native. Further debugging shows that was the problem, for RN here is the issue, it's already caused problems with this library before: For your issue, I'd recommend migrating to Vite, it's working for me there. module.exports = {
resolver: {
resolveRequest: (context, moduleName, platform) => {
if (moduleName.startsWith('@lingui/message-utils'))
moduleName = moduleName.replace('@lingui/message-utils/', '@lingui/message-utils/dist/');
return context.resolveRequest(context, moduleName, platform);
},
},
} |
The "exports": {
"./generateMessageId": {
"import": "./dist/generateMessageId.mjs",
"require": "./dist/generateMessageId.cjs",
"types": "./dist/generateMessageId.d.ts"
},
"./compileMessage": {
"import": "./dist/compileMessage.mjs",
"require": "./dist/compileMessage.cjs",
"types": "./dist/compileMessage.d.ts"
}
}, It seems like your current setup doesn't respect the |
I am observing this same issue that manifested after upgrading to My environment also uses Versions:
The error does not occur running the app (via
Changing all lingui ES6 Below is my lingui config:
I've also tried modifying |
For React Native users, I can confirm this is caused by Metro not supporting the In the meantime, patching your Metro config as @TheUltDev showed above works fine. If you are using {
resolver: {
resolveRequest: MetroSymlinksResolver({
remapModule: (_context, moduleName, _platform) => {
if (moduleName.startsWith("@lingui/message-utils"))
return moduleName.replace(
"@lingui/message-utils/",
"@lingui/message-utils/dist/",
)
else return moduleName
},
}),
}
} |
I managed to resolve this issue by adding the paths to the jest module mapper.
|
@wkerswell what version of jest you using? AFAIK since Jest 28 |
I am using Create react app, so it could well be using an earlier version. Will take a look and see if upgrading helps
|
Yes, CRA uses an ancient version of Jest, there are few pull request bumping it to 28 and 29, none of them are merged yet ( |
i've prepared a workaround addressing this issue https://github.com/lingui/js-lingui/pull/1650/files |
The workaround is published as https://github.com/lingui/js-lingui/releases/tag/v4.1.0 Please check, does it resolve the issue? |
@thekip Thank you for providing this workaround. I checked v4.1.0 and, at least in my usage, it produces another error when I remove the jest
The error points to a line using
this is being imported for use in a React functional component, e.g.,
|
@thekip lingui v4.1.1 fixed the issue for me. thank you! |
Describe the bug
To Reproduce
yarn test
Additional context
4.0.0
7.16.7
5.0.1
The text was updated successfully, but these errors were encountered: