UNPKG

jobsys-mpower

Version:

Enhanced component based on Taro & NutUI

30 lines (25 loc) 710 B
const mpFunctions = ["showToast", "showNotify", "showDialog", "showImagePreview"] function getMpResolved(name, options) { console.log(name, "MpUIResolver", options) return { name, from: "jobsys-mpower", sideEffects: "jobsys/dist/style.css", } } /** * Resolver for NutUI 4.0+ * * @link https://github.com/jdf2e/nutui */ export function MpUIResolver(options = {}) { return { type: "component", resolve: (name) => { const { autoImport = false } = options if (autoImport && mpFunctions.includes(name)) return getMpResolved(name, options) console.log("component", name) if (name.startsWith("Mp")) return getMpResolved(name.slice(2), options) }, } }