@jswork/scan-modules
TypeScript icon, indicating that this package has built-in type declarations

1.0.17 • Public • Published

scan-modules

Get module objects use vite or webpack.

version license size download

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.

/@jswork/scan-modules/

    Package Sidebar

    Install

    npm i @jswork/scan-modules

    Homepage

    js.work

    Weekly Downloads

    5

    Version

    1.0.17

    License

    MIT

    Unpacked Size

    34.7 kB

    Total Files

    43

    Last publish

    Collaborators

    • afeiship