FortAwesome / Font-Awesome

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

v6 is not compatible with ts-loader #18280

Open fredericrous opened 2 years ago

fredericrous commented 2 years ago

Describe the bug

ERROR in ./src/pages/Content/components/StoryItem.tsx 5:0-71
Module not found: Error: Package path ./import.macro is not exported from package /Users/fredericrous/Developer/Storyful/io-cms/node_modules/@fortawesome/fontawesome-svg-core (see exports field in /Users/fredericrous/Developer/Storyful/io-cms/node_modules/@fortawesome/fontawesome-svg-core/package.json)

To Reproduce configure webpack with ts-loader

  module: {
    rules: [
      { test: /\.tsx?$/, loader: 'ts-loader', exclude: /node_modules/ },

import fontawesome

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

declare the icon

 <FontAwesomeIcon icon={solid('trash-can')} />

Expected behavior I would like my icon to be loaded without having to switch to babel compiler

Version and implementation Version: 6.0.0-beta webpack version: 5.51.1

Bug report checklist

tagliala commented 2 years ago

Hi!

Thanks for being part of the Font Awesome Community and for this bug report.

I do not use TS, so I can't confirm. @robmadole could you please check?

tanguy-c commented 2 years ago

Any news about ts-loader compatibility?

robmadole commented 2 years ago

@tanguy-c have you tried 6.1.0?