smrq / babel-plugin-require-context-hook

Babel plugin to replicate Webpack require.context
47 stars 14 forks source link

alias: @ for src is not getting resolved, when running vue jest test #13

Open ashu99099 opened 3 years ago

ashu99099 commented 3 years ago

getting following error: `ENOENT: no such file or directory, scandir 'home/app/src/components/@/assets/icons'

at enumerateFiles (node_modules/babel-plugin-require-context-hook/register.js:12:8) at context (node_modules/babel-plugin-require-context-hook/register.js:27:16)`

The @ is being treated literally. since '@' is an alias for 'src'. The directory it should be looking at should be: 'src/assets/icons' (which is resolved from '@/assets/icons')

How can make babel-plugin-require-context-hook to resolve alias '@' to 'src'?