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

React Build Fails - Critical dependency: the request of a dependency is an expression #96

Closed
TobyDGosselin opened this issue Jun 21, 2020 · 6 comments
Labels
duplicate This issue or pull request already exists

Comments

@TobyDGosselin
Copy link

When building my react app using the default react-scripts production build I get failures in CI due to the following:

2:42:54 PM: Failed to compile.
2:42:54 PM: 
2:42:54 PM: ../node_modules/@giphy/js-brand/dist/index.js
2:42:54 PM: Critical dependency: the request of a dependency is an expression
2:42:54 PM: error Command failed with exit code 1.

Investigation has lead me to believe this is an issue with the giphy-js modules being bundled with parcel and CRA using webpack. Any suggestions on how to fix this?

@giannif
Copy link
Collaborator

giannif commented Jun 21, 2020

@TobyDGosselin this is usually a warning, and does not cause the build to fail, see #68

You can follow the steps there to remove the warning, but I think the error might be something else

@TobyDGosselin
Copy link
Author

@giannif I am not sure where to put that file. Do I need to eject my react app for that to work?

@giannif
Copy link
Collaborator

giannif commented Jun 21, 2020

@TobyDGosselin reference the parcel bundler issue that I linked in the other ticket to remove the warning: parcel-bundler/parcel#2883 (comment)

I don’t think this is what is failing your build, this has always just been a warning and does not make builds fail

@TobyDGosselin
Copy link
Author

@giannif it will fail the build because it is in CI.

2:41:40 PM: Creating an optimized production build...
2:42:54 PM: 
2:42:54 PM: Treating warnings as errors because process.env.CI = true.
2:42:54 PM: Most CI servers set it automatically.
2:42:54 PM: 
2:42:54 PM: Failed to compile.
2:42:54 PM: 
2:42:54 PM: ../node_modules/@giphy/js-brand/dist/index.js
2:42:54 PM: Critical dependency: the request of a dependency is an expression
2:42:54 PM: error Command failed with exit code 1.
2:42:54 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2:42:54 PM: error Command failed.
2:42:54 PM: Exit code: 1
2:42:54 PM: Command: /opt/buildhome/.nvm/versions/node/v10.21.0/bin/node
2:42:54 PM: Arguments: /opt/build/cache/yarn/lib/cli.js build
2:42:54 PM: Directory: /opt/build/repo/client

This is an actual issue and needs to be resolved. I don't want to have to run my release to prod with CI=''

@giannif
Copy link
Collaborator

giannif commented Jun 21, 2020

@TobyDGosselin okay then you’ll need to remove the warning as described in #68, there’s not much more I can do, it’s an issue with our bundler. I’ve never used create react app, so I can’t advise on whether or not you need to eject. Wish I could help more.

@giannif giannif closed this as completed Jun 21, 2020
@giannif giannif added the duplicate This issue or pull request already exists label Jun 21, 2020
@giannif
Copy link
Collaborator

giannif commented Jul 2, 2020

This should not be happening at all now with latest version, we are no longer using parcel for bundling our @giphy/js-brand repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants