vue-micro

1.0.8 • Public • Published

vue-micro

A tiny library to split large vue applications.

vue-micro

features

  • Accessible for vue ecosystem. vue 3.x and vue-router 4.x are required.
  • Can be used based on central esm registry or customized location.
  • Base url supported, easy to mount and integrate with current application,
  • A very tiny library (~2kb)

install & usage

npm install vue-micro -S

//vue-router
import router from './router';

// import micro library
import micro from './micro';

load esm dynamically

// from central registry
micro(router, 'https://registry.npm.js/libs');

// from customized url
micro(router, {
  micro_app_1_0_3: 'http://registry.npm.js/libs/micro_app1.0.3.esm.js,
  micro_app_other: 'http://registry.npm.js/libs/micro_app.other.esm.js'
  micro_app_module3: 'http://registry.npm.js/libs/micro_app.module3.esm.js'
  // ...
  // ...
})

mounting point, default: /micro/

micro(router, {}, '/another_mounting_point/');

Micro application Conventions

import app_routes from './application.routes.js';

export default {
  id: 'applicationId', // application Id
  routes: app_routes, // application routes
  methods: {
    clickHandler() {
      console.log('done');
    }
  },
  data() {
    return {
      foo: 'foovalue'
    };
  },
  render() {
    return h('span', 'Iam a micro application');
  }
};

Dependents (0)

Package Sidebar

Install

npm i vue-micro

Weekly Downloads

1

Version

1.0.8

License

none

Unpacked Size

229 kB

Total Files

4

Last publish

Collaborators

  • xinwangwang