@jswork/scan-modules
v1.0.17
Published
Get module objects use vite or webpack.
Downloads
54
Readme
scan-modules
Get module objects use vite or webpack.
installation
npm install @jswork/scan-modules
usage
import { scanVite, scanWebpack } from '@jswork/scan-modules';
// when vite
const moduleFiles = import.meta.glob('./shared/stores/**/*.ts', { eager: true });
const stores = scanVite(moduleFiles, { modules: '/stores/' });
// when webpack
const context = require.context('./shared/stores/modules', true, /\.ts$/);
const stores = scanWebpack(context, { modules: '/modules/' });
// result
const reuslt = {
"user": 'any',
"subChild2": 'any',
"subCtrl": 'any',
};
license
Code released under the MIT license.