more optimization
This commit is contained in:
@ -1,19 +1,23 @@
|
||||
const fs = require("fs")
|
||||
|
||||
const isProduction = process.env.NODE_ENV == "production";
|
||||
|
||||
const entry = {
|
||||
lib: "./src/index.ts",
|
||||
}
|
||||
|
||||
for (const file of fs.readdirSync("./test/")) {
|
||||
if (/.ts$/.test(file)) {
|
||||
const name = file.replace(/.ts$/, "")
|
||||
entry[`test/${name}`] = `./test/${file}`
|
||||
if (!isProduction) {
|
||||
for (const file of fs.readdirSync("./test/")) {
|
||||
if (/.ts$/.test(file)) {
|
||||
const name = file.replace(/.ts$/, "")
|
||||
entry[`test/${name}`] = `./test/${file}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
mode: process.env.NODE_ENV || "development",
|
||||
devtool: "inline-source-map",
|
||||
target: "browserslist",
|
||||
devtool: isProduction ? "source-map" : "eval",
|
||||
entry,
|
||||
resolve: {
|
||||
extensions: [".ts", ".js"],
|
||||
@ -27,9 +31,13 @@ module.exports = {
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
path: `${__dirname}/dist`,
|
||||
clean: true,
|
||||
library: {
|
||||
type: "umd",
|
||||
name: "Nostr",
|
||||
},
|
||||
},
|
||||
optimization: {
|
||||
usedExports: true,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user