mirror of
https://github.com/tlsnotary/explorer.git
synced 2026-01-09 12:57:54 -05:00
63 lines
1.4 KiB
JavaScript
Executable File
63 lines
1.4 KiB
JavaScript
Executable File
var webpack = require("webpack"),
|
|
path = require("path"),
|
|
CopyWebpackPlugin = require("copy-webpack-plugin"),
|
|
HtmlWebpackPlugin = require("html-webpack-plugin"),
|
|
TerserPlugin = require("terser-webpack-plugin");
|
|
var { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
|
|
const ASSET_PATH = process.env.ASSET_PATH || "/";
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== "production";
|
|
|
|
var options = {
|
|
mode: process.env.NODE_ENV || "development",
|
|
entry: {
|
|
index: path.join(__dirname, "server", "index.ts"),
|
|
},
|
|
output: {
|
|
filename: "[name].bundle.js",
|
|
path: path.resolve(__dirname, "build", "server"),
|
|
clean: true,
|
|
publicPath: ASSET_PATH,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(ts|tsx)$/,
|
|
exclude: /node_modules/,
|
|
use: [
|
|
{
|
|
loader: require.resolve("ts-loader"),
|
|
options: {
|
|
transpileOnly: isDevelopment,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new CleanWebpackPlugin({ verbose: false }),
|
|
new webpack.ProgressPlugin(),
|
|
new webpack.EnvironmentPlugin(["NODE_ENV"]),
|
|
].filter(Boolean),
|
|
infrastructureLogging: {
|
|
level: "info",
|
|
},
|
|
};
|
|
|
|
if (process.env.NODE_ENV === "development") {
|
|
options.devtool = "cheap-module-source-map";
|
|
} else {
|
|
options.optimization = {
|
|
minimize: true,
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
extractComments: false,
|
|
}),
|
|
],
|
|
};
|
|
}
|
|
|
|
module.exports = options;
|