FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
74.31k stars 12.21k forks source link

Bug: Cannot find module '@fortawesome-internal-tools/fontawesome-icons/canonical' #20307

Open dg-robinson opened 4 months ago

dg-robinson commented 4 months ago

Bug description

I've just updated from 6.5.2 to 6.6.0 and I've started getting this error in every file where I import icons, which I'm doing like this:

import { light } from "@fortawesome/fontawesome-svg-core/import.macro";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

I can update all of the style packages to 6.6.0, but if I update @fortawesome/fontawesome-svg-core then I start getting this issue. The stack trace is pointing to the imports in node_modules/@fortawesome/fontawesome-svg-core/import.macro.js.

This is happening in a React app with Craco and Babel, and I'm importing the packages via npm.

Reproducible test case

No response

Screenshots

No response

Font Awesome version

v6.6.0

Serving

Other (as specified in the bug description)

Implementation

SVG+JS

Browser and Operating System

Chrome 126.0.6478.183 on macOS 14.5

Web bug report checklist

tagliala commented 4 months ago

Hi!

Thanks for being part of the Font Awesome Community and thanks for reporting this.

Looks like a legit issue, let's assign @robmadole

Ref: https://github.com/FortAwesome/Font-Awesome/blob/37eff7fa00de26db41183a3ad8ed0e9119fbc44b/js-packages/%40fortawesome/fontawesome-svg-core/import.macro.js#L3-L4

robmadole commented 4 months ago

Yep, sure enough that's an internal tool that leaked into this module. We'll get this looked at and fixed as soon as we can.

allsyntax commented 4 months ago

Is this resolved? How do fix it? I'm seeing the same issue.

tagliala commented 4 months ago

Not fixed yet, sorry. Please keep an eye on this issue and wait for it to be closed

CarrieWDing commented 4 months ago

Is there a list of @fortawesome/fontawesome-svg-core versions impacted by the current error?

tagliala commented 4 months ago

99% confident that it's just 6.6.0

dg-robinson commented 4 months ago

Is there a list of @fortawesome/fontawesome-svg-core versions impacted by the current error?

Yep, only 6.6.0. It worked fine in 6.5.2 and below. You can still upgrade the individual icon libraries to 6.6.0 though.

mbrown1101 commented 3 months ago

Hey guys, is there an update on this or a workaround? We have 6.5.2 installed and are having this issue.

CarrieWDing commented 3 months ago

Hey guys, is there an update on this or a workaround? We have 6.5.2 installed and are having this issue.

We resolved the issue by removing the ^ symbol before the version number in the package.json, and then reinstalling the node_modules. Hope it helps.

jeffgaynor commented 3 months ago

@CarrieWDing is correct, the version needs to be locked to 6.5.2 for @fortawesome/fontawesome-svg-core only, so remove the ^. Here's a full example of the workaround:

   "@fortawesome/fontawesome-svg-core": "6.5.2",
    "@fortawesome/free-brands-svg-icons": "^6.6.0",
    "@fortawesome/pro-duotone-svg-icons": "^6.6.0",
    "@fortawesome/pro-light-svg-icons": "^6.6.0",
    "@fortawesome/pro-regular-svg-icons": "^6.6.0",
    "@fortawesome/pro-solid-svg-icons": "^6.6.0",
    "@fortawesome/react-fontawesome": "^0.2.2",
    "@fortawesome/sharp-light-svg-icons": "^6.6.0",

Reiterating a need for this fix, as it prevents standard updates.

liz-gunther commented 3 months ago

Also interested in a fix for this -- @CarrieWDing's solution worked for updating the package and the app compiles/runs fine, but we're having Cypress tests fail due to the unresolved internal dependency. I can't share the exact error message (I'm on my personal GH but the issue is happening in a project for work), but it's more or less as follows:

[webpack-dev-server] ERROR in ./x/x/x/
...
Error: /path/to/my/file.tsx: Cannot find module '@fortawesome-internal-tools/fontawesome-icons/canonical'
.... more of the stacktrace ....

Sounds like the issue is known so hopefully a fix will be in place soon :)

alternatively, if anyone can suggest a workaround for this in the meantime, I'm all ears!

tomerh2001 commented 2 months ago

Any updates? Downgrading all packages doesn't work for me, I still get the same error...

robmadole commented 2 months ago

No update yet, it's still on our list to be fixed. I will mention that we've had enough trouble with these Babel macros that we are making the call to deprecate them in favor of something more reliable. We've already updated our docs accordingly.

@tomerh2001 if you are still getting the error it means that you haven't actually downgraded. Can you double-check?

tomerh2001 commented 2 months ago

No update yet, it's still on our list to be fixed. I will mention that we've had enough trouble with these Babel macros that we are making the call to deprecate them in favor of something more reliable. We've already updated our docs accordingly.

@tomerh2001 if you are still getting the error it means that you haven't actually downgraded. Can you double-check?

Thanks, I just missed the ^. Adding it fixed it for now