Ask how to write a native js plug-in that supports the cmd,amd,commonjs specification

ask how to write a native js plug-in that supports the cmd,amd,commonjs specification

Feb.28,2021

just find a plug-in to copy the first few lines.
vue:

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
        typeof define === 'function' && define.amd ? define(factory) :
            (global.Vue = factory());
}(this, (function () {
    'use strict';

    var plugin = function () {
        console.log(1);
    }

    return plugin;
})));

https://github.com/egoist/bili

Menu