1
0
Fork 0
nodejs-typescript-webpack/webpack.config.js

40 lines
871 B
JavaScript
Raw Normal View History

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: [
{
2023-04-20 19:08:58 +00:00
from: path.resolve(__dirname, "pm2.production.json"),
},
{
from: path.resolve(__dirname, "package.json"),
},
{
from: path.resolve(__dirname, "yarn.lock"),
},
],
}),
],
};
module.exports = config;