2018-02-17 00:00:06 +00:00
|
|
|
const path = require("path");
|
|
|
|
const webpack = require("webpack");
|
2018-12-06 03:54:42 +00:00
|
|
|
const MiniCSSExtractPlugin = require("mini-css-extract-plugin");
|
2017-12-14 16:21:45 +00:00
|
|
|
|
|
|
|
module.exports = {
|
2018-12-06 03:54:42 +00:00
|
|
|
mode: process.env.NODE_ENV || "development",
|
|
|
|
|
2017-12-14 16:21:45 +00:00
|
|
|
entry: {
|
2018-07-31 17:13:26 +00:00
|
|
|
main: path.resolve(__dirname, "./modules/client/main.js"),
|
|
|
|
autoIndex: path.resolve(__dirname, "./modules/client/autoIndex.js")
|
2017-12-14 16:21:45 +00:00
|
|
|
},
|
|
|
|
|
2018-07-09 21:49:35 +00:00
|
|
|
externals: {
|
|
|
|
react: "React",
|
|
|
|
"react-dom": "ReactDOM",
|
|
|
|
"react-router-dom": "ReactRouterDOM"
|
|
|
|
},
|
|
|
|
|
2017-12-14 16:21:45 +00:00
|
|
|
output: {
|
2018-02-17 00:00:06 +00:00
|
|
|
filename: "[name]-[hash:8].js",
|
|
|
|
path: path.resolve(__dirname, "public/_assets"),
|
|
|
|
publicPath: "/_assets/"
|
2017-12-14 16:21:45 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
|
|
|
rules: [
|
2018-07-09 21:49:35 +00:00
|
|
|
{ test: /\.js$/, exclude: /node_modules/, use: "babel-loader" },
|
2018-07-31 17:07:27 +00:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2018-12-06 03:54:42 +00:00
|
|
|
use: [MiniCSSExtractPlugin.loader, "css-loader"]
|
2018-07-31 17:07:27 +00:00
|
|
|
},
|
2017-12-14 16:21:45 +00:00
|
|
|
{ test: /\.md$/, use: ["html-loader", "markdown-loader"] },
|
2018-07-09 21:49:35 +00:00
|
|
|
{ test: /\.png$/, use: "file-loader" }
|
2017-12-14 16:21:45 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2017-12-14 16:52:04 +00:00
|
|
|
new webpack.DefinePlugin({
|
2018-02-17 00:00:06 +00:00
|
|
|
"process.env.NODE_ENV": JSON.stringify(
|
|
|
|
process.env.NODE_ENV || "development"
|
|
|
|
)
|
2018-07-31 17:07:27 +00:00
|
|
|
}),
|
2018-12-06 03:54:42 +00:00
|
|
|
new MiniCSSExtractPlugin()
|
2017-12-14 16:21:45 +00:00
|
|
|
],
|
|
|
|
|
2018-02-17 00:00:06 +00:00
|
|
|
devtool:
|
|
|
|
process.env.NODE_ENV === "production" ? false : "cheap-module-source-map"
|
|
|
|
};
|