2019-10-09 04:29:46 +08:00
|
|
|
# example.js
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
import { increment as inc, value } from "./counter";
|
|
|
|
|
import { resetCounter, print } from "./methods";
|
|
|
|
|
print(value);
|
|
|
|
|
inc();
|
|
|
|
|
inc();
|
|
|
|
|
inc();
|
|
|
|
|
print(value);
|
|
|
|
|
resetCounter();
|
|
|
|
|
print(value);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# methods.js
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
export { reset as resetCounter } from "./counter";
|
|
|
|
|
|
|
|
|
|
export const print = value => console.log(value);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# counter.js
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
export let value = 0;
|
|
|
|
|
export function increment() {
|
|
|
|
|
value++;
|
|
|
|
|
}
|
|
|
|
|
export function decrement() {
|
|
|
|
|
value--;
|
|
|
|
|
}
|
|
|
|
|
export function reset() {
|
|
|
|
|
value = 0;
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# dist/output.js
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
/******/ "use strict";
|
|
|
|
|
/*!********************************!*\
|
|
|
|
|
!*** ./example.js + 2 modules ***!
|
|
|
|
|
\********************************/
|
2020-05-21 05:26:51 +08:00
|
|
|
/*! namespace exports */
|
2019-10-09 04:29:46 +08:00
|
|
|
/*! exports [not provided] [unused] */
|
2019-10-11 05:11:05 +08:00
|
|
|
/*! runtime requirements: */
|
2019-10-09 04:29:46 +08:00
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
|
|
|
|
|
|
```javascript
|
2020-05-21 05:26:51 +08:00
|
|
|
let o=0;function n(){o++}const c=o=>console.log(o);c(o),n(),n(),n(),c(o),o=0,c(o);
|
2019-10-09 04:29:46 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
# Info
|
|
|
|
|
|
|
|
|
|
## Unoptimized
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Hash: 0a1b2c3d4e5f6a7b8c9d
|
2020-05-21 05:26:51 +08:00
|
|
|
Version: webpack 5.0.0-beta.16
|
2019-10-11 05:11:05 +08:00
|
|
|
Asset Size
|
2020-05-21 05:26:51 +08:00
|
|
|
output.js 616 bytes [emitted] [name: main]
|
2019-10-09 04:29:46 +08:00
|
|
|
Entrypoint main = output.js
|
2019-10-11 05:11:05 +08:00
|
|
|
chunk output.js (main) 429 bytes [entry] [rendered]
|
2019-10-09 04:29:46 +08:00
|
|
|
> ./example.js main
|
2019-10-11 05:11:05 +08:00
|
|
|
./example.js + 2 modules 429 bytes [built]
|
2019-10-09 04:29:46 +08:00
|
|
|
[no exports]
|
|
|
|
|
[no exports used]
|
|
|
|
|
entry ./example.js main
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Production mode
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
Hash: 0a1b2c3d4e5f6a7b8c9d
|
2020-05-21 05:26:51 +08:00
|
|
|
Version: webpack 5.0.0-beta.16
|
2019-10-11 05:11:05 +08:00
|
|
|
Asset Size
|
2020-05-21 05:26:51 +08:00
|
|
|
output.js 82 bytes [emitted] [name: main]
|
2019-10-09 04:29:46 +08:00
|
|
|
Entrypoint main = output.js
|
2019-10-11 05:11:05 +08:00
|
|
|
chunk output.js (main) 429 bytes [entry] [rendered]
|
2019-10-09 04:29:46 +08:00
|
|
|
> ./example.js main
|
2019-10-11 05:11:05 +08:00
|
|
|
./example.js + 2 modules 429 bytes [built]
|
|
|
|
|
[no exports]
|
|
|
|
|
[no exports used]
|
|
|
|
|
entry ./example.js main
|
2019-10-09 04:29:46 +08:00
|
|
|
```
|