40 lines
871 B
JavaScript
40 lines
871 B
JavaScript
const nodeExternals = require("webpack-node-externals");
|
|
const path = require("path");
|
|
const CopyPlugin = require("copy-webpack-plugin");
|
|
|
|
const config = {
|
|
entry: "./src/index.ts",
|
|
mode: "production",
|
|
target: "node",
|
|
module: {
|
|
rules: [{ test: /\.ts$/, use: ["ts-loader"], exclude: /node_modules/ }],
|
|
},
|
|
resolve: {
|
|
extensions: [".ts"],
|
|
},
|
|
externalsPresets: { node: true },
|
|
externals: [nodeExternals()],
|
|
output: {
|
|
clean: true,
|
|
filename: "main.js",
|
|
path: path.resolve(__dirname, "dist"),
|
|
},
|
|
plugins: [
|
|
new CopyPlugin({
|
|
patterns: [
|
|
{
|
|
from: path.resolve(__dirname, "pm2.production.json"),
|
|
},
|
|
{
|
|
from: path.resolve(__dirname, "package.json"),
|
|
},
|
|
{
|
|
from: path.resolve(__dirname, "yarn.lock"),
|
|
},
|
|
],
|
|
}),
|
|
],
|
|
};
|
|
|
|
module.exports = config;
|