Skip to content

Regression / es fortawesome import broken in latest canary #54997

Closed
@mwawrusch

Description

@mwawrusch

Link to the code that reproduces this issue or a replay of the bug

https://codesandbox.io/p/sandbox/vercel-next-js-reproduction-template-go8s7s?file=%2Fapp%2Flayout.tsx

To Reproduce

use


    "@fortawesome/fontawesome-svg-core": "6.4.2",
    "@fortawesome/free-brands-svg-icons": "6.4.2",
    "@fortawesome/pro-light-svg-icons": "6.4.2",
    "@fortawesome/pro-regular-svg-icons": "6.4.2",
    "@fortawesome/pro-solid-svg-icons": "6.4.2",
    "@fortawesome/pro-thin-svg-icons": "6.4.2",
    "@fortawesome/react-fontawesome": "0.2.0",
    "@headlessui/react": "1.7.17",

import like so:

import { config } from '@fortawesome/fontawesome-svg-core'
import '@fortawesome/fontawesome-svg-core/styles.css'
config.autoAddCss = false

This works in canary .11 but not in .16 (haven't tested in between)

Current vs. Expected behavior

It should compile but doesnt.

Error in canary .16:

Module not found: ESM packages (@fortawesome/fontawesome-svg-core) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

Someone pointed out that it could be a problem similar to lucide-icons/lucide#1482

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.14.2
      npm: 9.5.0
      Yarn: 1.22.19
      pnpm: N/A
    Relevant Packages:
      next: 13.4.20-canary.11
      eslint-config-next: 13.4.16
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.2.2
    Next.js Config:
      output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Additional context

n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions