0.2.0 • Published 1 year ago
vue-modulize v0.2.0
vue-modulize
Warning
This package is still under heavy development and not indended for production use yetModularisation for Vue
- register modules that you want to use in your app
- define what a module is exporting to other modules
- provide exports of other modules in a module
Usage
Define modules
// modules/example.module.ts
import { defineModule } from 'vue-modulize'
export default defineModule({
name: 'example-module' // Name of the module (required)
providers: {} // Parts of other modules that are available in this module (optional)
exports: {} // Exported parts of the module can be anything: Helpers, routes, components etc. (optional)
})
Register the modules
import exampleModule from 'modules/example.module'
import { registerModules } from 'vue-modulize'
registerModules([exampleModule])
Keep in mind that modules can't be registered twice.
Use module
import { useModule } from 'vue-modulize'
const moduleExports = useModule('module-name')
Only registered modules can be used.
Use module providers
import { useModuleProviders } from 'vue-modulize'
const moduleProviders = useModuleProviders('module-name')
Only providers of registered modules can be used.
License
Unless otherwise noted, all source code is licensed under the MIT License.
Copyright (c) 2023 Jochen Hörmann