unstoppabledomains/resolution

v3.0.0 gives warning `Critical dependency: the request of a dependency is an expression`

mds1 opened this issue · 3 comments

mds1 commented

I recently updated to v3.0.0, and when included in the frontend webpack throws the below warning:

 WARNING  Compiled with 1 warnings

 warning  in ../node_modules/@unstoppabledomains/resolution/build/utils/requireOrFail.js

Critical dependency: the request of a dependency is an expression

The source of this warning is here:

return require(module)

Based on this issue, it seems this consequence of this warning is "every file below a certain path will be included into the bundle (which should certainly not be ignored)."

This is not ideal for frontends or libraries using the resolution library, as it means the full resolution library will always be included, which unnecessarily increases bundle size

@mds1 Thank you for the report. Do you experience this behaviour in yours project? Some of the imports are dynamic and they are not the part of the resolution package.json file so it should not affect bundle size.

mds1 commented

Hey @DeRain, the frontend folder of this branch is where I see the behavior. If you want to reproduce it: clone that repo, switch to the linked branch, run yarn from the project root then cd frontend and yarn dev

Some of the imports are dynamic and they are not the part of the resolution package.json file so it should not affect bundle size.

Got it, so if it's not an issue my only suggestion would be that it might be worth seeing if there's some way you can suppress the warning from webpack

Thanks!

Fixed in v7.1.2