adrema/resources/js/lib/requireModules.js

10 lines
341 B
JavaScript
Raw Normal View History

2023-05-19 01:06:46 +02:00
import {paramCase} from 'change-case';
export default function (context, Vue, prefix) {
2023-06-01 11:05:03 +02:00
for (const file in context) {
let componentName = paramCase(`${prefix}${file.replace(/^.*\/(.*?)\.vue$/g, '$1')}`);
2023-05-20 00:57:05 +02:00
2023-06-01 11:05:03 +02:00
Vue.component(componentName, typeof context[file] === 'function' ? context[file] : context[file].default);
}
2023-05-19 01:06:46 +02:00
}