-
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/core/compile' #1347
Comments
@thekip might it somehow be related to the recent changes in the build process? |
This line is wrong: https://github.com/lingui/js-lingui/blob/main/packages/core/src/i18n.ts#L4 This should be |
@semoal thank you! There is an explanation of why it was done in such way - #1343 (comment) what do you think about that? |
Looks like lingui/core/compile doesn't work in cjs environment for some reason. I will take a look |
You probably running this on a server side? |
@thekip Also, the Bundlephobia returns |
@salixor could you provide more context. I tried to reproduce but with no luck. Was it run on the server or not, version of nodejs, if bundler was used name and version of the bundler. Or... the minimal repo |
@Martin005 i quickly investigated issue with bundlephobia but didn't find a root cause. All entries in package.json pointing into right places. I also compared with other packages and everything seems fine. Need to dig deeper into the bundlephobia sourcecode or just create an issue on theirs repo. |
Actually, @lingui/cli indeed has an wrong entrypoint. It points to the ./build/index.js which is not exists (as far as i remember it was the same before my refactorings). But actually it should not be directly accessed in consumers code. Only |
hey there @thekip, had the same issue on React Native, rolled back to 3.15.0 for now. |
In react-native it's caused by this facebook/metro#670 I exposed cjs entry from |
Morning! Since yesterdays release 3.16.0, we also get the error "Cannot find module '@lingui/core/compile' from 'node_modules/@lingui/core/build/cjs/index.js' Currently no way to work around this issue. |
Hey, thanks a lot for looking into this ! Here are some additional infos. This exact error message happens in our unit tests ( We also have the following error when trying to build, serve the application, or run basically any command via We do use webpack4, which seems as react-native not to support the |
This workaround is working for me (react-native with expo) const { getDefaultConfig } = require("expo/metro-config");
const config = getDefaultConfig(__dirname);
// https://github.com/facebook/metro/issues/670 - this is a workaround for the issue
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (moduleName.startsWith("@lingui/core/compile")) {
moduleName = moduleName.replace(
"@lingui/core/compile",
"@lingui/core/build/cjs/compile.js"
);
}
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config; |
Describe the bug
Since release 3.16.0, the error "Cannot find module '@lingui/core/compile' from 'node_modules/@lingui/core/build/cjs/index.js'" pops up.
I'm unsure if it is an issue with my setup, or it is related to the global import of "compile" in lingui/core.
To Reproduce
No particular steps.
Expected behavior
N/A
Additional context
The text was updated successfully, but these errors were encountered: