-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Webpack build: Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #127
Comments
On reddit, there is this error: https://www.reddit.com/r/typescript/comments/4q09uv/help_webpack_weirdness_require_function_is_used/ According to some comment there, the reason might be that there is |
Hi, @dakur, is it possible to paste your webpack config or at least provide a minimal reproducible example? |
Hi @scriptex, thank you for your answer. I'm able to reproduce it with this minimal config: module.exports = {
entry: './index.js',
} I've also removed JS: import TouchSweep from 'touchsweep';
new TouchSweep(document.getElementById('test')) |
🤔 I was able to reproduce this and to be honest, I am not sure why this happens.
Webpack's docs do not say much about this configuration setting, though. |
Yes, The aforementioned reddit thread wasn't helpful? It seems to me that this could be the problem:
It well corresponds to code in |
Okay, looks like I need to change the way the module is built. I guess I will try Vite or Rollup but I don’t have the time right now. |
Not at all, I'll wait. Thank you very much! |
Yes, that works very well now, thank you very much! |
I'd say there must be something broken with the built file in
dist/
folder in v2. With v1.3 it worked well.I use ES modules everywhere and typescript (even though it failed in .js file as well).
Output from webpack build with
--stats-error-details
:The text was updated successfully, but these errors were encountered: