babel-plugin-relay dependency results in critical dependency warning when building with Webpack 5
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
I have a monorepo which uses `yarn workspaces` with `yarn berry`. I am running and bundling the react apps with `webpack 5`.
However, I can't get `babel-plugin-relay` working. When I'm trying to run the application, I keep getting these errors:
```
Compiled with problems:
WARNING in ../../../.yarn/cache/babel-plugin-macros-npm-2.8.0-451367d7e7-59b09a21cf.zip/node_modules/babel-plugin-macros/dist/index.js 78:24-31
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
WARNING in ../../../.yarn/cache/import-fresh-npm-3.3.0-3e34265ca9-2cacfad06e.zip/node_modules/import-fresh/index.js 32:31-48
Critical dependency: the request of a dependency is an expression
```
### My setup
My monorepo has the following form:
```
frontend/
apps/
app1/
.babelrc
package.json
app2/
.babelrc
package.json
app3/
.babelrc
package.json
packages/
.babelrc
package.json
// packages which will be shared with app1, app2 and app3
```
Every **app** and the **packages** have their own `package.json`. Where I have `babel-plugin-relay` as a dev dependency.
The `.babelrc` is situated in the root of each project of the monorepo (see above) and looks like
```json
{
"presets": ["@babel/preset-env", ["@babel/preset-react", { "runtime": "automatic" }], "@babel/preset-typescript"],
"plugins": [
["relay", { "artifactDirectory": "../../__generated__", "eagerESModules": true }],
["@babel/plugin-transform-runtime", { "regenerator": true }]
]
}
```
Anyone experiencing the same issue? Can anyone help? I'm stuck on this since days now.
Contributor guide
Assessment
This issue has not been assessed yet.