3cma 中文文档教程

发布于 4年前 浏览 25 更新于 3年前

example.js

import { increment as inc, value } from "./counter";
import { resetCounter, print } from "./methods";
print(value);
inc();
inc();
inc();
print(value);
resetCounter();
print(value);

methods.js

export { reset as resetCounter } from "./counter";

export const print = value => console.log(value);

counter.js

export let value = 0;
export function increment() {
    value++;
}
export function decrement() {
    value--;
}
export function reset() {
    value = 0;
}

dist/output.js

/******/ "use strict";
/*!********************************!*\
  !*** ./example.js + 2 modules ***!
  \********************************/
/*! namespace exports */
/*! exports [not provided] [unused] */
/*! runtime requirements:  */

// CONCATENATED MODULE: ./counter.js
let value = 0;
function increment() {
    value++;
}
function decrement() {
    value--;
}
function counter_reset() {
    value = 0;
}

// CONCATENATED MODULE: ./methods.js


const print = value => console.log(value);

// CONCATENATED MODULE: ./example.js


print(value);
increment();
increment();
increment();
print(value);
counter_reset();
print(value);

dist/output.js (production)

let o=0;function n(){o++}const c=o=>console.log(o);c(o),n(),n(),n(),c(o),o=0,c(o);

Info

Unoptimized

Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-beta.16
    Asset       Size
output.js  616 bytes  [emitted]  [name: main]
Entrypoint main = output.js
chunk output.js (main) 429 bytes [entry] [rendered]
    > ./example.js main
 ./example.js + 2 modules 429 bytes [built]
     [no exports]
     [no exports used]
     entry ./example.js main

Production mode

Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-beta.16
    Asset      Size
output.js  82 bytes  [emitted]  [name: main]
Entrypoint main = output.js
chunk output.js (main) 429 bytes [entry] [rendered]
    > ./example.js main
 ./example.js + 2 modules 429 bytes [built]
     [no exports]
     [no exports used]
     entry ./example.js main

example.js

import { increment as inc, value } from "./counter";
import { resetCounter, print } from "./methods";
print(value);
inc();
inc();
inc();
print(value);
resetCounter();
print(value);

methods.js

export { reset as resetCounter } from "./counter";

export const print = value => console.log(value);

counter.js

export let value = 0;
export function increment() {
    value++;
}
export function decrement() {
    value--;
}
export function reset() {
    value = 0;
}

dist/output.js

/******/ "use strict";
/*!********************************!*\
  !*** ./example.js + 2 modules ***!
  \********************************/
/*! namespace exports */
/*! exports [not provided] [unused] */
/*! runtime requirements:  */

// CONCATENATED MODULE: ./counter.js
let value = 0;
function increment() {
    value++;
}
function decrement() {
    value--;
}
function counter_reset() {
    value = 0;
}

// CONCATENATED MODULE: ./methods.js


const print = value => console.log(value);

// CONCATENATED MODULE: ./example.js


print(value);
increment();
increment();
increment();
print(value);
counter_reset();
print(value);

dist/output.js (production)

let o=0;function n(){o++}const c=o=>console.log(o);c(o),n(),n(),n(),c(o),o=0,c(o);

Info

Unoptimized

Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-beta.16
    Asset       Size
output.js  616 bytes  [emitted]  [name: main]
Entrypoint main = output.js
chunk output.js (main) 429 bytes [entry] [rendered]
    > ./example.js main
 ./example.js + 2 modules 429 bytes [built]
     [no exports]
     [no exports used]
     entry ./example.js main

Production mode

Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-beta.16
    Asset      Size
output.js  82 bytes  [emitted]  [name: main]
Entrypoint main = output.js
chunk output.js (main) 429 bytes [entry] [rendered]
    > ./example.js main
 ./example.js + 2 modules 429 bytes [built]
     [no exports]
     [no exports used]
     entry ./example.js main
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文