Skip to content

Commit

Permalink
build esm package
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Aug 12, 2024
1 parent f26ff1e commit fc6a38c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 20 deletions.
4 changes: 2 additions & 2 deletions javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypha-rpc",
"version": "0.20.15",
"version": "0.20.16",
"description": "Hypha RPC client for connecting to Hypha server for data management and AI model serving.",
"main": "index.js",
"types": "index.d.ts",
Expand Down
43 changes: 28 additions & 15 deletions javascript/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
const path = require('path');

module.exports = {
const commonConfig = {
mode: process.env.NODE_ENV || 'development',
entry: {
'hyphaWebsocketClient': path.resolve(__dirname, 'src', 'websocket-client.js'),
},
output: {
globalObject: 'this',
path: path.resolve(__dirname, 'dist'),
filename: (pathData) => {
const outputNames = {
"hyphaWebsocketClient": "hypha-rpc-websocket",
};
const name = outputNames[pathData.chunk.name];
return process.env.NODE_ENV === 'production' ? name + '.min.js' : name + '.js';
},
library: '[name]',
libraryTarget: 'umd',
umdNamedDefine: true
},
devtool: 'source-map',
devServer: {
static: {
Expand All @@ -42,3 +28,30 @@ module.exports = {
],
},
};

const umdConfig = {
...commonConfig,
output: {
path: path.resolve(__dirname, 'dist'),
filename: process.env.NODE_ENV === 'production' ? 'hypha-rpc-websocket.min.js' : 'hypha-rpc-websocket.js',
globalObject: 'this',
library: 'hyphaWebsocketClient',
libraryTarget: 'umd',
umdNamedDefine: true,
},
};

const esmConfig = {
...commonConfig,
output: {
path: path.resolve(__dirname, 'dist'),
filename: process.env.NODE_ENV === 'production' ? 'hypha-rpc-websocket.esm.min.js' : 'hypha-rpc-websocket.esm.js',
module: true,
libraryTarget: 'module',
},
experiments: {
outputModule: true, // Required for module output
},
};

module.exports = [umdConfig, esmConfig];
2 changes: 1 addition & 1 deletion python/hypha_rpc/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.15"
"version": "0.20.16"
}
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "hypha_rpc"
version = "0.20.15"
version = "0.20.16"
description = "Hypha RPC client for connecting to Hypha server for data management and AI model serving"
readme = "README.md"
requires-python = ">=3.6"
Expand Down

0 comments on commit fc6a38c

Please sign in to comment.