webpack/examples/coffee-script/README.md

146 lines
3.5 KiB
Markdown
Raw Normal View History

2012-03-27 06:00:51 +08:00
# example.js
2019-04-09 02:29:40 +08:00
```javascript
2013-02-13 18:58:13 +08:00
console.log(require("./cup1"));
2012-03-27 06:00:51 +08:00
```
# cup1.coffee
2019-04-09 02:29:40 +08:00
```coffee-script
2012-03-27 06:00:51 +08:00
module.exports =
cool: "stuff"
answer: 42
external: require "./cup2.coffee"
2013-02-13 18:58:13 +08:00
again: require "./cup2"
2012-03-27 06:00:51 +08:00
```
# cup2.coffee
2019-04-09 02:29:40 +08:00
```coffee-script
2012-03-27 06:00:51 +08:00
console.log "yeah coffee-script"
module.exports = 42
```
# dist/output.js
2012-03-27 06:00:51 +08:00
2019-04-09 02:29:40 +08:00
```javascript
2019-10-11 05:11:05 +08:00
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
/* 0 */,
2017-12-14 17:58:03 +08:00
/* 1 */
2013-02-13 18:58:13 +08:00
/*!*********************!*\
2015-06-13 23:41:14 +08:00
!*** ./cup1.coffee ***!
2013-02-13 18:58:13 +08:00
\*********************/
2019-08-05 19:32:25 +08:00
/*! exports [maybe provided (runtime-defined)] [no usage info] */
2019-11-15 07:06:30 +08:00
/*! runtime requirements: __webpack_require__, module */
2019-10-11 05:11:05 +08:00
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2013-02-13 18:58:13 +08:00
2016-09-07 18:28:56 +08:00
module.exports = {
cool: "stuff",
answer: 42,
2017-12-14 17:58:03 +08:00
external: __webpack_require__(/*! ./cup2.coffee */ 2),
again: __webpack_require__(/*! ./cup2 */ 2)
2016-09-07 18:28:56 +08:00
};
2013-10-31 07:49:59 +08:00
2013-02-13 18:58:13 +08:00
2017-12-14 17:58:03 +08:00
/***/ }),
/* 2 */
/*!*********************!*\
!*** ./cup2.coffee ***!
\*********************/
2019-08-05 19:32:25 +08:00
/*! exports [maybe provided (runtime-defined)] [no usage info] */
2018-12-19 21:05:17 +08:00
/*! runtime requirements: module */
2019-10-09 05:45:47 +08:00
/***/ ((module) => {
2017-12-14 17:58:03 +08:00
console.log("yeah coffee-script");
module.exports = 42;
2017-03-31 02:25:01 +08:00
/***/ })
2019-10-11 05:11:05 +08:00
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
!function() {
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! exports [maybe provided (runtime-defined)] [no usage info] */
/*! runtime requirements: __webpack_require__ */
console.log(__webpack_require__(/*! ./cup1 */ 1));
}();
/******/ })()
;
2012-03-27 06:00:51 +08:00
```
# Info
2017-12-14 17:58:03 +08:00
## Unoptimized
2012-03-27 06:00:51 +08:00
```
2017-12-14 17:58:03 +08:00
Hash: 0a1b2c3d4e5f6a7b8c9d
2019-11-15 07:06:30 +08:00
Version: webpack 5.0.0-beta.6
2019-10-11 05:11:05 +08:00
Asset Size
output.js 2.09 KiB [emitted] [name: main]
2016-09-07 18:28:56 +08:00
Entrypoint main = output.js
2019-10-11 05:11:05 +08:00
chunk output.js (main) 206 bytes [entry] [rendered]
2019-01-25 20:15:22 +08:00
> ./example.js main
2019-10-11 05:11:05 +08:00
./cup1.coffee 118 bytes [built]
2018-09-26 05:13:58 +08:00
[used exports unknown]
2019-10-11 05:11:05 +08:00
cjs require ./cup1 ./example.js 1:12-29
./cup2.coffee 57 bytes [built]
2018-09-26 05:13:58 +08:00
[used exports unknown]
2019-10-11 05:11:05 +08:00
cjs require ./cup2.coffee ./cup1.coffee 4:12-36
cjs require ./cup2 ./cup1.coffee 5:9-26
./example.js 31 bytes [built]
2018-09-26 05:13:58 +08:00
[used exports unknown]
2019-10-11 05:11:05 +08:00
entry ./example.js main
2012-03-27 06:00:51 +08:00
```
2017-12-14 17:58:03 +08:00
## Production mode
2012-03-27 06:00:51 +08:00
```
2017-12-14 17:58:03 +08:00
Hash: 0a1b2c3d4e5f6a7b8c9d
2019-11-15 07:06:30 +08:00
Version: webpack 5.0.0-beta.6
2019-10-11 05:11:05 +08:00
Asset Size
output.js 294 bytes [emitted] [name: main]
2016-09-07 18:28:56 +08:00
Entrypoint main = output.js
2019-10-11 05:11:05 +08:00
chunk output.js (main) 206 bytes [entry] [rendered]
2019-01-25 20:15:22 +08:00
> ./example.js main
2019-10-11 05:11:05 +08:00
./cup1.coffee 118 bytes [built]
cjs require ./cup1 ./example.js 1:12-29
./cup2.coffee 57 bytes [built]
cjs require ./cup2.coffee ./cup1.coffee 4:12-36
cjs require ./cup2 ./cup1.coffee 5:9-26
./example.js 31 bytes [built]
[no exports used]
entry ./example.js main
2019-04-09 02:29:40 +08:00
```