Skip to content

Commit

Permalink
Merge tag 'v4.30.0' into next
Browse files Browse the repository at this point in the history
4.30.0
  • Loading branch information
sokra committed May 9, 2019
2 parents 251605e + b72b96a commit b66143f
Show file tree
Hide file tree
Showing 145 changed files with 3,595 additions and 4,326 deletions.
2 changes: 1 addition & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ declare const $publicPath$;
declare const __webpack_require__;
declare const $hotChunkFilename$;
declare const $hotMainFilename$;
declare const WebAssembly;
declare namespace WebAssembly {}
declare const importScripts;
declare const $crossOriginLoading$;
declare const chunkId;
Expand Down
13 changes: 8 additions & 5 deletions declarations/WebpackOptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,13 @@ export type FilterItemTypes = RegExp | string | Function;

export interface WebpackOptions {
/**
* Set the value of `require.amd` and `define.amd`.
* Set the value of `require.amd` and `define.amd`. Or disable AMD support.
*/
amd?: {
[k: string]: any;
};
amd?:
| false
| {
[k: string]: any;
};
/**
* Report the first error as a hard error instead of tolerating it.
*/
Expand Down Expand Up @@ -1176,7 +1178,8 @@ export interface OutputOptions {
| "amd-require"
| "umd"
| "umd2"
| "jsonp";
| "jsonp"
| "system";
/**
* The output directory as **absolute path** (required).
*/
Expand Down
124 changes: 62 additions & 62 deletions examples/aggressive-merging/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# pageA.js

``` javascript
```javascript
require(["./common"], function(common) {
common(require("./a"));
});
```

# pageB.js

``` javascript
```javascript
require(["./common"], function(common) {
common(require("./b"));
});
```

# pageC.js

``` javascript
```javascript
require(["./a"], function(a) {
console.log(a + require("./b"));
});
Expand All @@ -28,7 +28,7 @@ a big file...

# webpack.config.js

``` javascript
```javascript
var path = require("path");
var AggressiveMergingPlugin = require("../../lib/optimize/AggressiveMergingPlugin");
module.exports = {
Expand Down Expand Up @@ -60,56 +60,56 @@ module.exports = {

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-alpha.9
Version: webpack 5.0.0-alpha.11
Asset Size Chunks Chunk Names
324.chunk.js 548 bytes {324} [emitted]
864.chunk.js 6.19 KiB {864} [emitted]
pageA.bundle.js 7.53 KiB {641} [emitted] pageA
pageB.bundle.js 7.54 KiB {791} [emitted] pageB
pageC.bundle.js 7.53 KiB {42} [emitted] pageC
394.chunk.js 548 bytes {394} [emitted]
456.chunk.js 6.19 KiB {456} [emitted]
pageA.bundle.js 7.51 KiB {424} [emitted] pageA
pageB.bundle.js 7.52 KiB {121} [emitted] pageB
pageC.bundle.js 7.51 KiB {178} [emitted] pageC
Entrypoint pageA = pageA.bundle.js
Entrypoint pageB = pageB.bundle.js
Entrypoint pageC = pageC.bundle.js
chunk {42} pageC.bundle.js (pageC) 68 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
chunk {121} pageB.bundle.js (pageB) 69 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageB pageB
[1] ./pageB.js 69 bytes {121} [built]
[used exports unknown]
entry ./pageB pageB
+ 4 hidden chunk modules
chunk {178} pageC.bundle.js (pageC) 68 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageC pageC
[2] ./pageC.js 68 bytes {42} [built]
[2] ./pageC.js 68 bytes {178} [built]
[used exports unknown]
entry ./pageC pageC
+ 4 hidden chunk modules
chunk {324} 324.chunk.js 42 bytes [rendered]
chunk {394} 394.chunk.js 42 bytes [rendered]
> ./a [2] ./pageC.js 1:0-3:2
[4] ./a.js 21 bytes {324} {864} [built]
[4] ./a.js 21 bytes {394} {456} [built]
[used exports unknown]
cjs require ./a [0] ./pageA.js 2:8-22
amd require ./a [2] ./pageC.js 1:0-3:2
[5] ./b.js 21 bytes {324} {864} [built]
[5] ./b.js 21 bytes {394} {456} [built]
[used exports unknown]
cjs require ./b [1] ./pageB.js 2:8-22
cjs require ./b [2] ./pageC.js 2:17-31
chunk {641} pageA.bundle.js (pageA) 69 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
chunk {424} pageA.bundle.js (pageA) 69 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageA pageA
[0] ./pageA.js 69 bytes {641} [built]
[0] ./pageA.js 69 bytes {424} [built]
[used exports unknown]
entry ./pageA pageA
+ 4 hidden chunk modules
chunk {791} pageB.bundle.js (pageB) 69 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
> ./pageB pageB
[1] ./pageB.js 69 bytes {791} [built]
[used exports unknown]
entry ./pageB pageB
+ 4 hidden chunk modules
chunk {864} 864.chunk.js 5.45 KiB [rendered]
chunk {456} 456.chunk.js 5.45 KiB [rendered]
> ./common [0] ./pageA.js 1:0-3:2
> ./common [1] ./pageB.js 1:0-3:2
[3] ./common.js 5.41 KiB {864} [built]
[3] ./common.js 5.41 KiB {456} [built]
[used exports unknown]
amd require ./common [0] ./pageA.js 1:0-3:2
amd require ./common [1] ./pageB.js 1:0-3:2
[4] ./a.js 21 bytes {324} {864} [built]
[4] ./a.js 21 bytes {394} {456} [built]
[used exports unknown]
cjs require ./a [0] ./pageA.js 2:8-22
amd require ./a [2] ./pageC.js 1:0-3:2
[5] ./b.js 21 bytes {324} {864} [built]
[5] ./b.js 21 bytes {394} {456} [built]
[used exports unknown]
cjs require ./b [1] ./pageB.js 2:8-22
cjs require ./b [2] ./pageC.js 2:17-31
Expand All @@ -119,49 +119,49 @@ chunk {864} 864.chunk.js 5.45 KiB [rendered]

```
Hash: 0a1b2c3d4e5f6a7b8c9d
Version: webpack 5.0.0-alpha.9
Version: webpack 5.0.0-alpha.11
Asset Size Chunks Chunk Names
324.chunk.js 123 bytes {324} [emitted]
864.chunk.js 182 bytes {324}, {864} [emitted]
pageA.bundle.js 1.42 KiB {641} [emitted] pageA
pageB.bundle.js 1.42 KiB {791} [emitted] pageB
pageC.bundle.js 1.43 KiB {42} [emitted] pageC
394.chunk.js 124 bytes {394} [emitted]
456.chunk.js 183 bytes {394}, {456} [emitted]
pageA.bundle.js 1.42 KiB {424} [emitted] pageA
pageB.bundle.js 1.42 KiB {121} [emitted] pageB
pageC.bundle.js 1.44 KiB {178} [emitted] pageC
Entrypoint pageA = pageA.bundle.js
Entrypoint pageB = pageB.bundle.js
Entrypoint pageC = pageC.bundle.js
chunk {42} pageC.bundle.js (pageC) 68 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
chunk {121} pageB.bundle.js (pageB) 69 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageB pageB
[588] ./pageB.js 69 bytes {121} [built]
entry ./pageB pageB
+ 4 hidden chunk modules
chunk {178} pageC.bundle.js (pageC) 68 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageC pageC
[912] ./pageC.js 68 bytes {42} [built]
[145] ./pageC.js 68 bytes {178} [built]
entry ./pageC pageC
+ 4 hidden chunk modules
chunk {324} 324.chunk.js 42 bytes [rendered]
> ./a [912] ./pageC.js 1:0-3:2
[21] ./b.js 21 bytes {324} {864} [built]
cjs require ./b [912] ./pageC.js 2:17-31
cjs require ./b [954] ./pageB.js 2:8-22
[162] ./a.js 21 bytes {324} {864} [built]
amd require ./a [912] ./pageC.js 1:0-3:2
cjs require ./a [953] ./pageA.js 2:8-22
chunk {641} pageA.bundle.js (pageA) 69 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
chunk {394} 394.chunk.js 42 bytes [rendered]
> ./a [145] ./pageC.js 1:0-3:2
[847] ./a.js 21 bytes {394} {456} [built]
amd require ./a [145] ./pageC.js 1:0-3:2
cjs require ./a [366] ./pageA.js 2:8-22
[996] ./b.js 21 bytes {394} {456} [built]
cjs require ./b [145] ./pageC.js 2:17-31
cjs require ./b [588] ./pageB.js 2:8-22
chunk {424} pageA.bundle.js (pageA) 69 bytes (javascript) 3.64 KiB (runtime) [entry] [rendered]
> ./pageA pageA
[953] ./pageA.js 69 bytes {641} [built]
[366] ./pageA.js 69 bytes {424} [built]
entry ./pageA pageA
+ 4 hidden chunk modules
chunk {791} pageB.bundle.js (pageB) 69 bytes (javascript) 3.65 KiB (runtime) [entry] [rendered]
> ./pageB pageB
[954] ./pageB.js 69 bytes {791} [built]
entry ./pageB pageB
+ 4 hidden chunk modules
chunk {864} 864.chunk.js 5.45 KiB [rendered]
> ./common [953] ./pageA.js 1:0-3:2
> ./common [954] ./pageB.js 1:0-3:2
[21] ./b.js 21 bytes {324} {864} [built]
cjs require ./b [912] ./pageC.js 2:17-31
cjs require ./b [954] ./pageB.js 2:8-22
[162] ./a.js 21 bytes {324} {864} [built]
amd require ./a [912] ./pageC.js 1:0-3:2
cjs require ./a [953] ./pageA.js 2:8-22
[280] ./common.js 5.41 KiB {864} [built]
amd require ./common [953] ./pageA.js 1:0-3:2
amd require ./common [954] ./pageB.js 1:0-3:2
chunk {456} 456.chunk.js 5.45 KiB [rendered]
> ./common [366] ./pageA.js 1:0-3:2
> ./common [588] ./pageB.js 1:0-3:2
[543] ./common.js 5.41 KiB {456} [built]
amd require ./common [366] ./pageA.js 1:0-3:2
amd require ./common [588] ./pageB.js 1:0-3:2
[847] ./a.js 21 bytes {394} {456} [built]
amd require ./a [145] ./pageC.js 1:0-3:2
cjs require ./a [366] ./pageA.js 2:8-22
[996] ./b.js 21 bytes {394} {456} [built]
cjs require ./b [145] ./pageC.js 2:17-31
cjs require ./b [588] ./pageB.js 2:8-22
```
20 changes: 10 additions & 10 deletions examples/aggressive-merging/template.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# pageA.js

``` javascript
{{pageA.js}}
```javascript
_{{pageA.js}}_
```

# pageB.js

``` javascript
{{pageB.js}}
```javascript
_{{pageB.js}}_
```

# pageC.js

``` javascript
{{pageC.js}}
```javascript
_{{pageC.js}}_
```

# common.js
Expand All @@ -22,20 +22,20 @@ a big file...

# webpack.config.js

``` javascript
{{webpack.config.js}}
```javascript
_{{webpack.config.js}}_
```

# Info

## Unoptimized

```
{{stdout}}
_{{stdout}}_
```

## Production mode

```
{{production:stdout}}
_{{production:stdout}}_
```
7 changes: 7 additions & 0 deletions examples/build-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const doCompileAndReplace = (args, prefix, callback) => {
if(fs.existsSync("dist"))
for(const file of fs.readdirSync("dist"))
fs.unlinkSync(`dist/${file}`);

try {
require.resolve("webpack-cli");
} catch (e) {
throw new Error("Please install webpack-cli at root.");
}

cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => {
if(stderr)
console.log(stderr);
Expand Down
Loading

0 comments on commit b66143f

Please sign in to comment.