webpack/examples/coffee-script/README.md

172 lines
4.0 KiB
Markdown
Raw Normal View History

2012-04-05 20:59:01 +08:00
2012-03-27 06:00:51 +08:00
# example.js
``` javascript
console.log(require("./cup1.coffee"));
```
# cup1.coffee
``` coffee-script
module.exports =
cool: "stuff"
answer: 42
external: require "./cup2.coffee"
again: require "./cup2.coffee"
```
# cup2.coffee
``` coffee-script
console.log "yeah coffee-script"
module.exports = 42
```
# js/output.js
``` javascript
/******/(function(modules) {
/******/ var installedModules = {};
/******/ function require(moduleId) {
/******/ if(typeof moduleId !== "number") throw new Error("Cannot find module '"+moduleId+"'");
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ var module = installedModules[moduleId] = {
2012-08-23 08:05:07 +08:00
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
2012-03-27 06:00:51 +08:00
/******/ };
/******/ modules[moduleId](module, module.exports, require);
2012-08-23 08:05:07 +08:00
/******/ module.loaded = true;
2012-03-27 06:00:51 +08:00
/******/ return module.exports;
/******/ }
2012-05-22 04:59:31 +08:00
/******/ require.e = function(chunkId, callback) {
2012-03-27 06:00:51 +08:00
/******/ callback(require);
/******/ };
2012-05-17 18:47:06 +08:00
/******/ require.modules = modules;
2012-07-11 23:53:46 +08:00
/******/ require.cache = installedModules;
2012-03-27 06:00:51 +08:00
/******/ return require(0);
/******/})
2012-08-07 04:19:15 +08:00
/******/({c:"",
2012-03-27 06:00:51 +08:00
/******/0: function(module, exports, require) {
2012-07-11 23:53:46 +08:00
/*** .\example.js ***/
2012-04-05 20:59:01 +08:00
/******/ /* WEBPACK FREE VAR INJECTION */ (function(console) {
console.log(require(/* ./cup1.coffee */3));
2012-04-05 20:59:01 +08:00
/******/ /* WEBPACK FREE VAR INJECTION */ }(require(/* __webpack_console */1)))
2012-03-27 06:00:51 +08:00
/******/},
/******/
/******/1: function(module, exports, require) {
2012-07-11 23:53:46 +08:00
/*** (webpack)\buildin\__webpack_console.js ***/
2012-08-07 04:19:15 +08:00
var console = (function() { return this["console"] || (this["window"] && this["window"].console) || {} }());
2012-04-05 20:59:01 +08:00
module.exports = console;
for(var name in {log:1, info:1, error:1, warn:1, dir:1, trace:1, assert:1})
if(!console[name])
console[name] = function() {};
2012-07-19 18:03:56 +08:00
var times = {};
2012-04-05 20:59:01 +08:00
if(!console.time)
console.time = function(label) {
2012-03-27 06:00:51 +08:00
times[label] = Date.now();
};
2012-04-05 20:59:01 +08:00
if(!console.timeEnd)
console.timeEnd = function() {
2012-03-27 06:00:51 +08:00
var duration = Date.now() - times[label];
2012-04-05 20:59:01 +08:00
console.log('%s: %dms', label, duration);
2012-03-27 06:00:51 +08:00
};
/******/},
/******/
/******/2: function(module, exports, require) {
2012-07-11 23:53:46 +08:00
/*** (webpack)\~\coffee-loader!.\cup2.coffee ***/
/******/ /* WEBPACK FREE VAR INJECTION */ (function(console) {
2012-03-27 06:00:51 +08:00
(function() {
console.log("yeah coffee-script");
module.exports = 42;
2012-03-27 06:00:51 +08:00
}).call(this);
/******/ /* WEBPACK FREE VAR INJECTION */ }(require(/* __webpack_console */1)))
2012-03-27 06:00:51 +08:00
/******/},
/******/
/******/3: function(module, exports, require) {
2012-07-11 23:53:46 +08:00
/*** (webpack)\~\coffee-loader!.\cup1.coffee ***/
2012-03-27 06:00:51 +08:00
(function() {
module.exports = {
cool: "stuff",
answer: 42,
external: require(/* ./cup2.coffee */2),
again: require(/* ./cup2.coffee */2)
};
2012-03-27 06:00:51 +08:00
}).call(this);
/******/},
/******/
/******/})
```
# Info
## Uncompressed
```
2012-08-23 08:05:07 +08:00
Hash: 474013c0b0bff5edce1407a1cb805a35
Compile Time: 135ms
2012-03-27 06:00:51 +08:00
Chunks: 1
Modules: 4
Modules including duplicates: 4
Modules first chunk: 4
2012-10-09 06:12:10 +08:00
main output.js: 2407 chars/bytes
<id> <size> <filename>
<reason> from <filename>
2012-03-27 06:00:51 +08:00
output.js
0 43 .\example.js
2012-03-27 06:00:51 +08:00
main
2012-08-07 04:19:15 +08:00
1 516 (webpack)\buildin\__webpack_console.js
2012-04-05 20:59:01 +08:00
require (1x) from .\example.js
2012-10-09 06:12:10 +08:00
require (1x) from (webpack)\~\coffee-loader!.\cup2.coffee
2 92 (webpack)\~\coffee-loader!.\cup2.coffee
2012-10-09 06:12:10 +08:00
require (2x) from (webpack)\~\coffee-loader!.\cup1.coffee
3 178 (webpack)\~\coffee-loader!.\cup1.coffee
require (1x) from .\example.js
2012-03-27 06:00:51 +08:00
```
## Minimized (uglify-js, no zip)
```
2012-08-23 08:05:07 +08:00
Hash: 19d4c8993b53d92be00e044dd3101c86
Compile Time: 220ms
2012-03-27 06:00:51 +08:00
Chunks: 1
Modules: 4
Modules including duplicates: 4
Modules first chunk: 4
2012-10-09 06:12:10 +08:00
main output.js: 891 chars/bytes
<id> <size> <filename>
<reason> from <filename>
2012-03-27 06:00:51 +08:00
output.js
0 23 .\example.js
2012-03-27 06:00:51 +08:00
main
2012-08-07 04:19:15 +08:00
1 402 (webpack)\buildin\__webpack_console.js
2012-04-05 20:59:01 +08:00
require (1x) from .\example.js
2012-10-09 06:12:10 +08:00
require (1x) from (webpack)\~\coffee-loader!.\cup2.coffee
2 76 (webpack)\~\coffee-loader!.\cup2.coffee
2012-10-09 06:12:10 +08:00
require (2x) from (webpack)\~\coffee-loader!.\cup1.coffee
3 101 (webpack)\~\coffee-loader!.\cup1.coffee
require (1x) from .\example.js
2012-03-27 06:00:51 +08:00
```