Skip to content

Instantly share code, notes, and snippets.

@sunnyone
Created June 16, 2020 12:41
Show Gist options
  • Save sunnyone/fff31675ed4ead757ace09933d9e02f1 to your computer and use it in GitHub Desktop.
Save sunnyone/fff31675ed4ead757ace09933d9e02f1 to your computer and use it in GitHub Desktop.
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const path = require("path");
const glob = require("glob");
module.exports = {
target: "node",
entry: Object.fromEntries(
glob.sync("*/*.ts", {cwd: "src/ts/functions"})
.map((x) => [x.replace(/\.ts$/, ""), `./src/ts/functions/${x}`])),
output: {
filename: "[name].js",
path: path.resolve(__dirname, "build/functions"),
libraryTarget: "commonjs2",
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [{loader: "ts-loader"}],
},
],
},
externals: ["aws-sdk"],
resolve: {
extensions: [".ts"],
},
plugins: [new ForkTsCheckerWebpackPlugin({eslint: {files: "./src/ts/**/*"}})],
optimization: {minimize: false},
devtool: "source-map",
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment