Skip to content

Instantly share code, notes, and snippets.

@HereChen
Created March 15, 2018 10:17
Show Gist options
  • Save HereChen/0bad97977863dee442a410f2d0cd41b5 to your computer and use it in GitHub Desktop.
Save HereChen/0bad97977863dee442a410f2d0cd41b5 to your computer and use it in GitHub Desktop.
AMD, CommonJS, Browser surport for npm package
(function (global, factory) {
// 1. CommonJS: typeof exports === 'object' && typeof module !== 'undefined'
// 2. AMD: typeof define === 'function' && define.amd
// 3. Browser
// factory: function () { 'use strict'; }
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.Vue = factory());
}(this, (function () {
'use strict';
// code
})));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment