10000 Error when trying to run React application with babel-plugin-relay and Webpack 5 · Issue #15666 · webpack/webpack · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Error when trying to run React application with babel-plugin-relay and Webpack 5 #15666

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

Closed
Poolshark opened this issue Apr 14, 2022 · 1 comment

Comments

@Poolshark
Copy link

I have recently set up my monorepo of multiple React apps with Yarn workspaces and Webbpack 5 (they used to be CRAs, managed with Lerna, built and run via Craco/React Scripts).

I've had a little bit of a hard time to get it all running but I have experienced 2 weird warnings I cannot get rid of and I'm also not sure what happens here:

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

The package babel-plugin-macros is a dependency of the babel-relay-plugin. However, I came across a post where the author claimed that these warnings might be caused by asynchronous calls!? I am really stuck here - should I be concerned? I haven't tested the entire application yet, but so far it seems everything is running smooth. Can I safely ignore these warnings? If not, how could I get rd of them?

Thanks! 🙌

Relevant setup
  • yarn: version berry v3.2.0
  • webpack: v5.72.0
  • babel-plugin-relay: v13.2.0
@vankop
Copy link
Member
vankop commented Apr 15, 2022

Critical dependency: the request of a dependency is an expression

this means you have something like

let var1 = someCall();
require(var1); // webpack can't determine var1 value

https://github.com/sindresorhus/import-fresh/blob/main/index.js#L32 report there. ( not sure that this should work with webpack )

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

this is something like

importSomeModules(require); 
// or
const myRequire = require;

where require is not call expression (require(), require.resolve())

in case of babel-plugin-macros this is

function macrosPlugin(babel, // istanbul doesn't like the default of an object for the plugin options
// but I think older versions of babel didn't always pass options
// istanbul ignore next
{
  require: _require = require,
  resolvePath = nodeResolvePath,
  isMacrosName = testMacrosRegex,
  ...options
} = {}) {}

please report about this in babel-plugin-macros

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

2 participants
0