Last active
August 29, 2015 14:28
-
-
Save suisho/082047e2af95e2b7461b to your computer and use it in GitHub Desktop.
Browserifyのオプションつけるとどんな出力になるのかを検証する。 ref: http://qiita.com/inuscript/items/1fe19d32011e39ed8e2b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
var $ = require("jquery") | |
console.log($(".foo")) | |
}, { | |
"jquery": undefined | |
}] | |
}, {}, [1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browserify -e ./src/entry.js -i ./lib/somelib.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="./build/require.js"></script> | |
<script type="text/javascript" src="./build/entry.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -r jquery | |
$ browserify -r ./lib/somelib.js | |
$ browserify ./src/entry-jquery.js -u jquery -x ./lib/somelib.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="../build/jquery-bundle.js"></script> | |
<script type="text/javascript" src="../build/require-bundle.js"></script> | |
<script type="text/javascript" src="../build/entry-jquery.js"></script> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify ./lib/standalone.js -s standalone |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(f) { | |
// 省略 | |
// window.standalone = module | |
// になるようなコードが書かれている | |
})(function() { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
module.exports = function() { | |
console.log("Standaloneなモジュールだよ”") | |
} | |
}, {}] | |
}, {}, [1])(1) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -e ./src/entry1.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -e ./src/entry.js -i ./lib/somelib.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
}, {}], | |
2: [function(require, module, exports) { | |
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() | |
}, { | |
"../lib/somelib": 1 | |
}] | |
}, {}, [2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -e ./src/ignore.js -i iconv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
module.exports = function() { | |
console.log("somelibだよ!") | |
} | |
}, {}], | |
2: [function(require, module, exports) { | |
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() | |
}, { | |
"../lib/somelib": 1 | |
}] | |
}, {}, [2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -e ./src/entry.js -e ./src/entry3.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
module.exports = function() { | |
console.log("somelibだよ!") | |
} | |
}, {}], | |
2: [function(require, module, exports) { | |
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() | |
}, { | |
"../lib/somelib": 1 | |
}], | |
3: [function(require, module, exports) { | |
console.log("entry3だよ!") | |
}, {}] | |
}, {}, [2, 3]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ browserify -r ./lib/somelib.js | |
$ browserify -e ./src/entry1.js -x ./lib/**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
}, {}], | |
2: [function(require, module, exports) { | |
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() | |
}, { | |
"../lib/somelib": 1 | |
}] | |
}, {}, [2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="./build/require.js"></script> | |
<script type="text/javascript" src="./build/entry.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function e(t, n, r) { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
module.exports = function() { | |
console.log("somelibだよ!") | |
} | |
}, {}], | |
2: [function(require, module, exports) { | |
console.log("entry1だよ!") | |
var lib = require("../lib/somelib") | |
lib() | |
}, { | |
"../lib/somelib": 1 | |
}], | |
3: [function(require, module, exports) { | |
console.log("entry3だよ!") | |
}, {}] | |
}, {}, [2, 3]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require = (function e(t, n, r) { | |
// 省略 | |
})({ | |
"/lib/somelib.js": [function(require, module, exports) { | |
module.exports = function() { | |
console.log("somelibだよ!") | |
} | |
}, {}] | |
}, {}, []); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(){ | |
console.log("somelibだよ!") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(f) { | |
// 省略 | |
// window.standalone = module | |
// になるようなコードが書かれている | |
})(function() { | |
// 省略 | |
})({ | |
1: [function(require, module, exports) { | |
module.exports = function() { | |
console.log("Standaloneなモジュールだよ”") | |
} | |
}, {}] | |
}, {}, [1])(1) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment