Skip to content

Commit

Permalink
websocket for browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
azahnen committed Oct 18, 2024
1 parent ac3f8ea commit 99cabf4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
23 changes: 15 additions & 8 deletions libxtracfg/js/xtracfg-transport-websocket/.esbuild.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
import { build } from "esbuild";
import { clean } from "esbuild-plugin-clean";

await build({
const common = {
entryPoints: ["src/index.ts"],
bundle: true,
platform: "node",
target: "node20",
format: "esm",
minify: true,
//logLevel: "debug",
/*loader: {
".node": "copy",
},*/
outdir: "build",
outbase: "node_modules",
entryNames: "[name]",
define: {
"process.env.NODE_ENV": '"production"',
},
};

await build({
...common,
platform: "node",
target: "node20",
entryNames: "[name]",
plugins: [
clean({
patterns: ["./build/*"],
}),
],
});

await build({
...common,
platform: "browser",
target: "esnext",
entryNames: "[name].browser",
});
1 change: 1 addition & 0 deletions libxtracfg/js/xtracfg-transport-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "MIT",
"type": "module",
"main": "build/index.js",
"browser": "build/index.browser.js",
"types": "build/index.d.ts",
"scripts": {
"build": "node .esbuild.js && tsc --declaration --emitDeclarationOnly",
Expand Down

0 comments on commit 99cabf4

Please sign in to comment.