question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

🐛 Description

When upgrading from magic-sdk v6.2.1 to magic-sdk v8.1.0 within a perfectly working VueJS3 project, I am getting this warning when serving my app (yarn serve):

 WARNING  Compiled with 1 warning                                                                                                                                                                                 
 warning  in ./node_modules/magic-sdk/dist/es/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

🌎 Environment

Software Version(s)
magic-sdk 8.1.0
Browser Chrome
yarn 1.22.17
Operating System Windows

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:23 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
Ethellacommented, May 2, 2022

I was about to say I found no issues reported during the build because you already fixed it 🚀.

I’ll update our doc to reflect your suggestion. Thx a lot!

2reactions
Adamj1232commented, May 2, 2022

@Ethella I have a fix for react using CRACO

const path = require("path");

module.exports = {
  reactScriptsVersion: "react-scripts" /* (default value) */,

  webpack: {
    alias: {
      "magic-sdk": path.resolve(
        __dirname,
        "node_modules/magic-sdk/dist/cjs/index.js"
      ),
    },
  },
};

For pure webpack I believe alias is nested with resolveresolve.alias...

These would be helpful to add to your documentation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Critical dependency: require function is used in a way in which ...
Critical dependency : require function is used in a way in which dependencies cannot be statically extracted · Subscribe to RSS.
Read more >
Critical dependency: require function is used in a way ... - GitHub
The error originates from the esm target, which should not have any require statements. It'd be nice to explore that built module and...
Read more >
Incompatible with Webpack - Google Groups
"require function is used in a way, in which dependencies cannot be statically extracted" These errors come when trying to "require" specific modules, ......
Read more >
Critical dependency: require function is ... - Auth0 Community
Error message : Critical dependency: require function is used in a way in which dependencies cannot be statically extracted.
Read more >
Use es6 import with cesium and angular - CesiumJS
Critical dependency : require function is used in a way in which dependencies cannot be statically extracted. WARNING in .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found