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

Hello,

I have been following along with this introductory Auth0 React app build-along (link below) and have been running into the same error over and over and can’t seem to find any solution. I made this yesterday and it worked 100% until it crashed and gave me this the error message below. I restarted the app many times, rebooted my computer, but nothing fixed it. To check my sanity, I started this project from scratch again but the error message still occurred.

I went to the path where the error was located but couldn’t find anything that stood out to me. The problem seems to have started as soon as I installed the npm SDK npm install --save @auth0/auth0-spa-js because before I installed that, the app was working just fine and text was displaying as it should. As soon as you install the SDK, the text disappears.

I even deleted the entire auth0 package in the node_modules folder just to see what would happen and the same error message occurred. Does anyone have some insight into this problem? I am losing my mind and any help would be greatly appreciated!

Code-along link: https://auth0.com/blog/authenticating-your-first-react-app/

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

Error location: ./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js

SDK: npm install --save @auth0/auth0-spa-js (version 1.8.0)

3 Likes

2 posts were merged into an existing topic: Authenticating Your First React App