Skip to content
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

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #1866

Closed
mrexox opened this issue Sep 19, 2022 · 5 comments · Fixed by #1873

Comments

@mrexox
Copy link

mrexox commented Sep 19, 2022

I understand the reasons for this code, but it seems like a buggy thing. It always throws a warning, and for some checks/linters warnings are considered as errors.

const { JSDOM } = require('jsdom');
return new JSDOM().window.document;
} catch {
// ignore
}
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require('min-document');

When starting a server, I get two warnings:

./node_modules/@remirror/core-utils/dist/remirror-core-utils.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

./node_modules/@remirror/core-utils/dist/remirror-core-utils.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ocavue
Copy link
Member

ocavue commented Sep 20, 2022

When starting a server, I get two warnings:

Could you share me an example repo for such warning? I'm not exactly sure how to reproduce the problem.

@mrexox
Copy link
Author

mrexox commented Sep 20, 2022

Here is the basic repo I could create to reproduce the issue: https://github.com/mrexox/test-remirror-warning

@mrexox
Copy link
Author

mrexox commented Sep 22, 2022

Hey @ocavue! Was it helpful? Do you need more information or maybe you've got an idea and I can prepare the PR?

@ocavue
Copy link
Member

ocavue commented Sep 22, 2022

Your repo is useful. I'm already working on a PR based on your replication. Thanks!

@mrexox
Copy link
Author

mrexox commented Sep 23, 2022

Thank you very much for the quick fix! I really appreciate your fast response 🙏 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants