Skip to content

Commit 32ebbfd

Browse files
committed
Beautify webpack configs
1 parent 5954cba commit 32ebbfd

File tree

43 files changed

+326
-285
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+326
-285
lines changed

examples/coffee-script/webpack.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
module.exports = {
22
// mode: "development || "production",
33
module: {
4-
rules: [
5-
{ test: /\.coffee$/, loader: "coffee-loader" }
6-
]
4+
rules: [{
5+
test: /\.coffee$/,
6+
loader: "coffee-loader"
7+
}]
78
},
89
resolve: {
910
extensions: [".web.coffee", ".web.js", ".coffee", ".js"]

examples/explicit-vendor-chunk/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var webpack = require("../../");
33
module.exports = [
4+
45
{
56
name: "vendor",
67
// mode: "development || "production",
@@ -17,6 +18,7 @@ module.exports = [
1718
})
1819
]
1920
},
21+
2022
{
2123
name: "app",
2224
// mode: "development || "production",
@@ -36,4 +38,5 @@ module.exports = [
3638
})
3739
]
3840
}
41+
3942
];

examples/loader/webpack.config.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module.exports = {
22
// mode: "development || "production",
33
module: {
4-
rules: [
5-
{ test: /\.css$/, loader: "css-loader" }
6-
]
4+
rules: [{
5+
test: /\.css$/,
6+
loader: "css-loader"
7+
}]
78
}
89
};

examples/multi-compiler/webpack.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var path = require("path");
22
var webpack = require("../../");
33
module.exports = [
4+
45
{
56
name: "mobile",
67
// mode: "development || "production",
@@ -15,6 +16,7 @@ module.exports = [
1516
})
1617
]
1718
},
19+
1820
{
1921
name: "desktop",
2022
// mode: "development || "production",
@@ -29,4 +31,5 @@ module.exports = [
2931
})
3032
]
3133
}
34+
3235
];

examples/wasm-simple/webpack.config.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ module.exports = {
55
publicPath: "js/"
66
},
77
module: {
8-
rules: [
9-
{
10-
test: /\.wasm$/,
11-
type: "webassembly/experimental"
12-
}
13-
]
8+
rules: [{
9+
test: /\.wasm$/,
10+
type: "webassembly/experimental"
11+
}]
1412
},
1513
optimization: {
1614
occurrenceOrder: true // To keep filename consistent between different modes (for example building only)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

test/configCases/context-replacement/d/webpack.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@ var webpack = require("../../../../");
33

44
module.exports = {
55
module: {
6-
rules: [
7-
{
8-
test: /a\.js$/,
9-
use: [
10-
"./queryloader?lions=roar"
11-
]
12-
}
13-
]
6+
rules: [{
7+
test: /a\.js$/,
8+
use: [
9+
"./queryloader?lions=roar"
10+
]
11+
}]
1412
},
1513
plugins: [
1614
new webpack.ContextReplacementPlugin(/context-replacement.d$/, path.resolve(__dirname, "modules?cats=meow"), {

test/configCases/delegated-hash/simple/webpack.config.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,28 @@ module.exports = {
88
type: "require",
99
context: __dirname,
1010
content: {
11-
"./a.js": { id: 0 },
12-
"./loader.js!./b.js": { id: 1 },
13-
"./dir/c.js": { id: 2 }
11+
"./a.js": {
12+
id: 0
13+
},
14+
"./loader.js!./b.js": {
15+
id: 1
16+
},
17+
"./dir/c.js": {
18+
id: 2
19+
}
1420
}
1521
}),
1622
new DelegatedPlugin({
1723
source: "./bundle2",
1824
type: "object",
1925
context: __dirname,
2026
content: {
21-
"./d.js": { id: 3 },
22-
"./e.js": { id: 4 }
27+
"./d.js": {
28+
id: 3
29+
},
30+
"./e.js": {
31+
id: 4
32+
}
2333
}
2434
})
2535
]

test/configCases/delegated/simple/webpack.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ module.exports = {
66
type: "require",
77
context: __dirname,
88
content: {
9-
"./a.js": { id: 0 },
10-
"./loader.js!./b.js": { id: 1 },
11-
"./dir/c.js": { id: 2 }
9+
"./a.js": {
10+
id: 0
11+
},
12+
"./loader.js!./b.js": {
13+
id: 1
14+
},
15+
"./dir/c.js": {
16+
id: 2
17+
}
1218
}
1319
})
1420
]

test/configCases/dll-plugin/0-create-dll/webpack.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@ module.exports = {
1212
libraryTarget: "commonjs2"
1313
},
1414
module: {
15-
rules: [
16-
{
17-
test: /\.abc\.js$/,
18-
loader: "./g-loader.js",
19-
options: {
20-
test: 1
21-
}
15+
rules: [{
16+
test: /\.abc\.js$/,
17+
loader: "./g-loader.js",
18+
options: {
19+
test: 1
2220
}
23-
]
21+
}]
2422
},
2523
plugins: [
2624
new webpack.DllPlugin({

0 commit comments

Comments
 (0)