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

require function is used in a way in which dependencies cannot be statically extracted #447

Closed
nojaf opened this issue May 1, 2020 · 14 comments

Comments

@nojaf
Copy link

nojaf commented May 1, 2020

Description

When upgrading to 1.8.0 my create-react-app build is failing:

$ react-scripts build
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

See https://github.com/nojaf/capital-guardian/runs/636017737

Reproduction

My example project:
https://github.com/nojaf/capital-guardian/blob/master/client/src/App.js
https://github.com/nojaf/capital-guardian/blob/master/client/src/auth0Config.js

Environment

Please provide the following:

  • Version of this library used: 1.8.0
  • Version of the platform or framework used, if applicable:
  • Other relevant versions (language, server software, OS, browser): create-react-app, "react-scripts": "3.4.1",
  • Other modules/plugins/libraries that might be involved:
@stevehobbsdev
Copy link
Contributor

Thanks for raising @nojaf - can you confirm if this was also a problem in 1.7?

@nojaf
Copy link
Author

nojaf commented May 1, 2020

I checked and it is not a problem with 1.7.

@dannynpham
Copy link

I'm having the exact same issue after I updated to 1.8.0

@qortex
Copy link

qortex commented May 2, 2020

Same here after updating to 1.8.0.

With Angular, it's a warning and not an error though:

WARNING in ./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js 15:49939-49946
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

@belachkar
Copy link

belachkar commented May 2, 2020

The same warning Using Angular on @1.8.0:

[WDS] Warnings while compiling.
./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js 15:49939-49946
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

@sdhwa92
Copy link

sdhwa92 commented May 2, 2020

With Angular, I'm getting the same warning on @1.8.0:

WARNING in ./node_modules/@auth0/auth0-spa-js/dist/auth0-spa-js.production.esm.js 15:49939-49946
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

@duro
Copy link

duro commented May 3, 2020

I actually had to downgrade all the way down to 1.6.0 to get this to work, but with that, lost all typescript types.

@belachkar
Copy link

@duro The 1.7.0 works perfectly for me.

@shorn
Copy link

shorn commented May 4, 2020

Working with create-react-app 3.4.1 build environment.
Can confirm warning shows up on version 1.8.0, but is not present for versions 1.6.5 or 1.7.0.

Tried changing my import style from

import Auth0Client from "@auth0/auth0-spa-js/dist/typings/Auth0Client";

to

import createAuth0Client, {Auth0Client} from "@auth0/auth0-spa-js";

but that didn't seem to make a difference.

My workaround is to go back to 1.6.5 to avoid "broken window syndrome" around warnings.

Here is a public project that reproduces: Rabbit

@jackall3n
Copy link

jackall3n commented May 4, 2020

I was pulling my hair out last week with this, can clarify that is it certainly working on version 1.7.0 and 1.8.0 is the problem version.

I suspect the issue may be either the typescript exclusions here or the update torollup-plugin-web-worker-loader here

There aren't a huge amount of changes in this version.

@stevehobbsdev
Copy link
Contributor

Thanks all, we've identified it as an issue with the latest version of rollup-plugin-web-worker-loader and we're working with them to resolve it. It looks like they published some extra stuff that they didn't intend to in that release and it's broken other aspects that they didn't intend. As well as that, it's highlighted a gap in our testing and we're working to resolve that too!

paulfalgout added a commit to RoundingWell/care-ops-frontend that referenced this issue May 6, 2020
Notably Cypress now supports testing components easier https://github.com/bahmutov/cypress-react-unit-test  However they're currently catering to react and vue it'd be nice to investigate setting this up for our own components.. Although what we have works fine.

Then we can't get update auth0-spa-js until auth0/auth0-spa-js#447 is resolved
@adamjmcgrath
Copy link
Contributor

Hi all, we've released 1.8.1 which should resolve the issue.

Can you try it out and let us know if you run into any issues?

@vuhrmeister
Copy link

works!

@nojaf
Copy link
Author

nojaf commented May 6, 2020

1.8.1 works for me. Many thanks!

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

No branches or pull requests