Skip to content

Commit 0eab0dc

Browse files
committed
Make webpack dev server config to be more useful
Don't rebuild the docs constantly, use the nice webpack livereload feature instead. Changes are now instantaneous when working with CSS/JS
1 parent 3503493 commit 0eab0dc

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

webpack.dev.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,29 @@ const common = require("./webpack.common.js");
88
module.exports = merge(common, {
99
mode: "development",
1010
watch: true,
11+
// The dev server uses both contentBase and publicPath. The contentBase is
12+
// used to server the built docs, and publicPath is the bundle path for live
13+
// reloading. The publicPath intercepts requests to the static assets in
14+
// _static/. Opening http://localhost:1919 is everything you need for
15+
// development.
1116
devServer: {
12-
contentBase: path.join(__dirname, "docs/build/html"),
13-
watchContentBase: true,
14-
compress: false,
17+
contentBase: "docs/build/html",
1518
port: 1919,
19+
open: false,
1620
hot: false,
1721
liveReload: true,
18-
publicPath: "/_static/"
22+
publicPath: "/_static/",
23+
disableHostCheck: true,
24+
headers: {
25+
"Access-Control-Allow-Origin": "*"
26+
}
1927
},
2028
plugins: [
2129
new WatchPlugin({
2230
files: ["./docs/**/*.rst", "./docs/**/*.py"]
2331
}),
2432
new ShellPlugin({
25-
onBuildEnd: ["make -C docs clean html"],
26-
// dev=false here to force every build to trigger make, the default is
27-
// first build only.
28-
dev: false
33+
onBuildStart: ["make -C docs clean html"],
2934
})
3035
]
3136
});

0 commit comments

Comments
 (0)