FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 262 forks source link

macro causes module not found #524

Closed yz-xlame closed 1 year ago

yz-xlame commented 1 year ago

config: babel-plugin-macros.config.js:

module.exports = {
  'fontawesome-svg-core': {
    license: 'pro', // my team is using the pro version
  },
};

.babelrc:

{
  "presets": [...],
  "plugins": [
    "macros",
     ...
  ]
}

build result:

Module not found: Error: Can't resolve '@babel/helper-module-imports' in '... /node_modules/@fortawesome/fontawesome-svg-core'
Module not found: Error: Can't resolve 'fs' in '... node_modules/babel-plugin-macros/node_modules/resolve/lib'
Module not found: Error: Can't resolve 'module' in '... node_modules/import-fresh/node_modules/resolve-from'
Module not found: Error: Can't resolve 'fs' in '... node_modules/import-fresh/node_modules/resolve-from'
yz-xlame commented 1 year ago

if chang webpack config:

...
    fallback: {
      fs: false,
      module: false,
    },
...

error: Module not found: Error: Can't resolve '@babel/helper-module-imports'

run npm i @babel/helper-module-imports build success, but @fortawesome/fontawesome-svg-core/import.macro icon return undefined

yz-xlame commented 1 year ago

I think it should be a configuration problem somewhere in my project