Allow to use unibabel.hex as a ES6 module #1

Открыто
Ghost хочет смерджить 1 коммит(ов) из <deleted>:master в master
Ghost прокомментировал 5 лет назад

This PR makes unibabel.hex to be used as a module.
unibabel.hex can be used like: import { Unibabel } from 'unibabel/unibabel.hex.js';

This PR makes unibabel.hex to be used as a module. unibabel.hex can be used like: `import { Unibabel } from 'unibabel/unibabel.hex.js';`
coolaj86 рассмотрел(а) изменения 5 лет назад
coolaj86 оставил комментарий

Loo

coolaj86 прокомментировал 5 лет назад
Владелец

I'm just seeing this now.

It looks like this breaks browser compatibility.

I think this should fix it, would you mind testing?

-var _index = require('./index.js');
-
-
-
-var Unibabel = _interopRequireWildcard(_index).Unibabel;
-
-
-
-function _interopRequireWildcard(obj) {
-
-  if (obj && obj.__esModule) {
-
-    return obj;
-
-  } else {
-
-    var newObj = {};
-
-    if (obj != null) {
-
-      for (var key in obj) {
-
-        if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
-
-      }
-
-    }
-
-    newObj.default = obj;
-
-    return newObj;
-
-  }
-
-}

To:

var Unibabel = exports.Unibabel || require('./index.js').Unibabel;

It really sucks that there are so many JavaScript-knockoff languages and frameworks that don't maintain compatibility with JavaScript and expect you to break compatibility or add lots of boilerplate to get them to work with The Real McCoy.

I'm just seeing this now. It looks like this breaks browser compatibility. I think this should fix it, would you mind testing? ```js -var _index = require('./index.js'); - - - -var Unibabel = _interopRequireWildcard(_index).Unibabel; - - - -function _interopRequireWildcard(obj) { - - if (obj && obj.__esModule) { - - return obj; - - } else { - - var newObj = {}; - - if (obj != null) { - - for (var key in obj) { - - if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; - - } - - } - - newObj.default = obj; - - return newObj; - - } - -} ``` To: ```js var Unibabel = exports.Unibabel || require('./index.js').Unibabel; ``` It really sucks that there are so many JavaScript-knockoff languages and frameworks that don't maintain compatibility with JavaScript and expect you to break compatibility or add lots of boilerplate to get them to work with The Real McCoy.
Этот Pull Request имеет изменения, конфликтующие с целевой веткой.
package.json
Войдите, чтобы присоединиться к обсуждению.
Нет рецензентов
Нет меток
Нет этапа
Нет назначенных лиц
2 участников
Уведомления
Срок выполнения

Срок выполнения не установлен.

Зависимости

Этот запрос на слияние в настоящее время не имеет никаких зависимостей.

Загрузка…
Пока нет содержимого.