adrema/resources/js/lib/requireModules.js

12 lines
385 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-05-20 00:57:05 +02:00
var isAsync = context.name === 'webpackAsyncContext';
2023-05-19 01:06:46 +02:00
context.keys().forEach((file) => {
let componentName = paramCase(`${prefix}${file.replace(/^\.\/(.*?)\.vue$/g, '$1')}`);
2023-05-20 00:57:05 +02:00
Vue.component(componentName, isAsync ? () => context(file) : context(file).default);
2023-05-19 01:06:46 +02:00
});
}