All Products
Search
Document Center

resource

Last Updated: May 25, 2021

Kylin-plugin-resource is a resource interception mechanism designed for global offline resource packages on the mPaaS platform.

Use the plug-in

The package.json file in the scaffold file contains the following configuration:

 
  1. ["resource",
  2. {
  3. "map": {
  4. "vue": {
  5. "external": "Vue",
  6. "js": "https://gw.alipayobjects.com/as/g/h5-lib/vue/2.5.13/vue.min.js"
  7. },
  8. "fastclick": {
  9. "external": "FastClick",
  10. "js": "https://as.alipayobjects.com/g/luna-component/luna-fastclick/0.1.0/index.js"
  11. }
  12. }
  13. }
  14. ]

The above configuration indicates that some actions will be implemented when the following dependency statements appear:

 
  1. import xxx from 'vue';
  2. var xxx = require('vue');

When the vue dependency is used, the following actions are implemented:

  1. Inject the <script src="https://gw.alipayobjects.com/as/g/h5-lib/vue/2.5.13/vue.min.js" ></script> script resource into the generated HTML template.
  2. Redirect the preceding vue dependency to the value of window.Vue.