Skip to content

Instantly share code, notes, and snippets.

@erukiti
Last active November 18, 2017 02:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erukiti/b095b586e799fc65719765519fe7127a to your computer and use it in GitHub Desktop.
Save erukiti/b095b586e799fc65719765519fe7127a to your computer and use it in GitHub Desktop.

https://teratail.com/questions/100985?sip=n0070000_019&uid=60668

babel-preset-gas で、gas適用できるように変換できるのだけど、それはコンパイル対象のソースだけ。 なので、自分の書いたソースだけはgas適用されるけど、babel-core より先は、既にコンパイルされているものを、 browserifyが愚直に結合するだけなので、module.default が残っちゃう

解決方法

  1. babel-coreやその他を自前でbuildしてしまう (かなり面倒)
  2. dist/ にはき出したソースを原始的に置換する
sed -e 's/^exports.default/exports["default"]/' < dist/index.js > dist/index2.js

とか

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = load;
var babel = require("babel-core");
function load() {
return babel;
}
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = load;
var babel = require("babel-core");
function load() {
return babel;
}
var babel = require("babel-core");
export default function load(){
return babel;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment