boopathi/react-svg-loader

building error - 'no filename was passed to Babel'

alex-shamshurin opened this issue · 4 comments

It's a last version 3.0.1

ERROR in ./src/img/deal.svg
Module build failed (from ../node_modules/react-svg-loader/lib/loader.js):
Error: Configuration contains string/RegExp pattern, but no filename was passed to Babel
    at matchPattern (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:431:11)
    at /Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:418:35
    at Array.some (<anonymous>)
    at matchesPatterns (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:418:19)
    at shouldIgnore (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:404:17)
    at /Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:272:11
    at Array.some (<anonymous>)
    at /Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:267:26
    at buildRootChain (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/config-chain.js:90:20)
    at loadPrivatePartialConfig (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/partial.js:85:55)
    at loadFullConfig (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/config/full.js:43:39)
    at transformSync (/Users/avshamshurin/workspace/filebar/node_modules/@babel/core/lib/transform.js:41:38)
    at /Users/avshamshurin/workspace/filebar/node_modules/react-svg-core/lib/index.js:30:45
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

I found this too. Do you have a babel.config.js file in your project? I think this is caused by a project babel config which should be ignored.
I fixed this locally by adding configFile: false next to babelrc: false in the babel transform call.
https://github.com/boopathi/react-svg-loader/blob/master/packages/react-svg-core/src/index.js#L22-L26

When you plan to publish new version with that fix?

Great fix! Can we get this fix published soon? Needing it as well 🙏

Please publish it!!