Skip to content

Commit 5eea12a

Browse files
hiroppyevilebottnawi
authored andcommitted
chore(examples): fix examples (#1741)
1 parent 1911c37 commit 5eea12a

File tree

5 files changed

+31
-20
lines changed

5 files changed

+31
-20
lines changed

examples/.assets/layout.html

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html>
33
<head>
44
<title>WDS ▻ <%= htmlWebpackPlugin.options.title %></title>
5-
<meta charset="utf-8"/>
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<link rel="shortcut icon" href="/.assets/favicon.ico"/>
8-
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,400i,500,600"/>
9-
<link rel="stylesheet" href="/.assets/style.css"/>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<link rel="shortcut icon" href=".assets/favicon.ico" />
8+
<link
9+
rel="stylesheet"
10+
href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,400i,500,600"
11+
/>
12+
<link rel="stylesheet" href=".assets/style.css" />
1013
</head>
11-
<body>
14+
<body>
1215
<main>
1316
<header>
1417
<h1>
15-
<img src="/.assets/icon-square.svg" style="width: 35px; height: 35px;"/>
18+
<img
19+
src=".assets/icon-square.svg"
20+
style="width: 35px; height: 35px;"
21+
/>
1622
webpack-dev-server
1723
</h1>
1824
</header>
@@ -21,6 +27,5 @@ <h2><%= htmlWebpackPlugin.options.title %></h2>
2127
<div id="target"></div>
2228
</section>
2329
</main>
24-
<script src="/bundle.js" type="text/javascript" charset="utf-8"></script>
25-
</body>
30+
</body>
2631
</html>

examples/api/middleware/server.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ const devServerOptions = Object.assign({}, webpackConfig.devServer, {
99
stats: {
1010
colors: true,
1111
},
12-
before(app) {
13-
app.use((req, res, next) => {
14-
console.log(`Using middleware for ${req.url}`);
15-
next();
16-
});
17-
},
1812
});
1913
const server = new WebpackDevServer(compiler, devServerOptions);
2014

examples/general/config-array/webpack.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict';
22

3-
const webpack = require('webpack');
43
// our setup function adds behind-the-scenes bits to the config that all of our
54
// examples need
65
const { setup } = require('../../util');
@@ -42,6 +41,8 @@ module.exports = [
4241
},
4342
],
4443
},
45-
plugins: [new webpack.optimize.UglifyJsPlugin()],
44+
optimization: {
45+
minimize: true,
46+
},
4647
}),
4748
];

examples/general/config-promise/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22

33
// Change the following line and save to see the compilation status
44

5-
document.write('It works!');
5+
const target = document.querySelector('#target');
6+
7+
target.classList.add('pass');
8+
target.innerHTML = 'Success!';

examples/util.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,15 @@ module.exports = {
8484
result.devServer.before = before;
8585
}
8686

87-
result.output = { path: path.dirname(module.parent.filename) };
87+
const output = {
88+
path: path.dirname(module.parent.filename),
89+
};
90+
91+
if (result.output) {
92+
Object.assign(result.output, output);
93+
} else {
94+
result.output = output;
95+
}
8896

8997
return result;
9098
},

0 commit comments

Comments
 (0)