mirror of
https://github.com/rowtype-yoga/psfp.git
synced 2024-09-11 16:25:36 +03:00
41 lines
1012 B
JavaScript
41 lines
1012 B
JavaScript
const webpack = require("webpack");
|
|
const merge = require("webpack-merge");
|
|
const path = require("path");
|
|
const common = require("./webpack.common.js");
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
const isWebpackDevServer = process.argv.some(
|
|
(a) => path.basename(a) === "webpack-dev-server"
|
|
);
|
|
const isWatch = process.argv.some((a) => a === "--watch");
|
|
|
|
const plugins =
|
|
isWebpackDevServer || !isWatch
|
|
? []
|
|
: [
|
|
function () {
|
|
this.plugin("done", function (stats) {
|
|
process.stderr.write(stats.toString("errors-only"));
|
|
});
|
|
},
|
|
];
|
|
module.exports = merge(common, {
|
|
mode: "development",
|
|
devtool: "eval-source-map",
|
|
|
|
devServer: {
|
|
contentBase: path.resolve(__dirname, "dist"),
|
|
port: 4008,
|
|
stats: "errors-only",
|
|
},
|
|
|
|
plugins: [
|
|
new webpack.LoaderOptionsPlugin({
|
|
debug: true,
|
|
}),
|
|
new HtmlWebpackPlugin({
|
|
title: "Purescript Fan Page",
|
|
template: "index.html",
|
|
}),
|
|
].concat(plugins),
|
|
});
|