babel-plugin-wildcard
babel-plugin-wildcard copied to clipboard
wildcard and resolve.alias can't work at the same time
wildcard and resolve.alias can't work at the same time my project is built with VueCli3 webpack set the resolve.alias '@' folder:
src/
├─ views/
│ ├─ index.vue
│ ├─ test.vue
code:
import { Index as temp } from '@/views/*';
console.log(temp);
error:Uncaught Error: Cannot find module '@/views/*'
I don't know about webpack resolve.alias specifically but for this I use: https://www.npmjs.com/package/babel-plugin-root-import which is babel plugin that makes babel resolve the @
path. (There's also https://www.npmjs.com/package/babel-plugin-module-resolver which is popular but I don't use that one personally)