Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

babel-plugin-transform-es2015-modules-umd #49

Open
yaoningvital opened this issue Mar 5, 2019 · 0 comments
Open

babel-plugin-transform-es2015-modules-umd #49

yaoningvital opened this issue Mar 5, 2019 · 0 comments

Comments

@yaoningvital
Copy link
Owner

yaoningvital commented Mar 5, 2019

babel-plugin-transform-es2015-modules-umd

这个插件的作用就是:将ES6 模块规范的代码转成 UMD模块化规范的代码。
关于JS中几种模块化规范(AMD、CMD、CommonJS、UMD、ES6的Module语法)的介绍请查看这里

In

export default 42;

Out

(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports);
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports);
    global.actual = mod.exports;
  }
})(this, function (exports) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });

  exports.default = 42;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant