Server render auto-index pages

Also, load the autoIndex bundle on the client so we can use React
instead of using an inline script.
This commit is contained in:
Michael Jackson
2018-07-31 10:07:27 -07:00
parent 168ccf5aac
commit 135da0fdc5
62 changed files with 761 additions and 589 deletions

View File

@ -1,9 +1,11 @@
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
main: path.resolve(__dirname, "client/main.js")
main: path.resolve(__dirname, "./server/client/main.js"),
autoIndex: path.resolve(__dirname, "./server/client/autoIndex.js")
},
externals: {
@ -21,7 +23,13 @@ module.exports = {
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, use: "babel-loader" },
{ test: /\.css$/, use: ["style-loader", "css-loader"] },
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: "css-loader"
})
},
{ test: /\.md$/, use: ["html-loader", "markdown-loader"] },
{ test: /\.png$/, use: "file-loader" }
]
@ -32,7 +40,8 @@ module.exports = {
"process.env.NODE_ENV": JSON.stringify(
process.env.NODE_ENV || "development"
)
})
}),
new ExtractTextPlugin("[name]-[hash:8].css")
],
devtool: