snort/packages/nostr/webpack.config.js

44 lines
846 B
JavaScript
Raw Normal View History

2023-04-05 14:00:36 +00:00
const fs = require("fs")
2023-05-17 22:02:43 +00:00
const isProduction = process.env.NODE_ENV == "production";
2023-04-05 14:00:36 +00:00
const entry = {
lib: "./src/index.ts",
}
2023-05-17 22:02:43 +00:00
if (!isProduction) {
for (const file of fs.readdirSync("./test/")) {
if (/.ts$/.test(file)) {
const name = file.replace(/.ts$/, "")
entry[`test/${name}`] = `./test/${file}`
}
2023-04-05 14:00:36 +00:00
}
}
module.exports = {
mode: process.env.NODE_ENV || "development",
2023-05-17 22:02:43 +00:00
target: "browserslist",
devtool: isProduction ? "source-map" : "eval",
2023-04-05 14:00:36 +00:00
entry,
resolve: {
extensions: [".ts", ".js"],
fallback: {
crypto: false,
},
},
module: {
rules: [{ test: /\.ts$/, use: "ts-loader" }],
},
output: {
filename: "[name].js",
path: `${__dirname}/dist`,
2023-05-17 22:02:43 +00:00
clean: true,
2023-04-08 19:14:08 +00:00
library: {
type: "umd",
name: "Nostr",
},
2023-04-05 14:00:36 +00:00
},
2023-05-17 22:02:43 +00:00
optimization: {
usedExports: true,
},
2023-04-05 14:00:36 +00:00
}