This commit is contained in:
Andras Schmelczer 2025-03-15 15:06:06 +00:00
parent 9ad54eff7a
commit 15a09dff95
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
6 changed files with 59 additions and 75 deletions

View file

@ -1,31 +1,36 @@
{
"name": "sync-client",
"version": "0.0.0",
"private": true,
"main": "dist/index.js",
"main": "dist/sync-client.node.js",
"browser": "dist/sync-client.web.js",
"types": "dist/types/index.d.ts",
"module": "src/index.js",
"files": [
"dist/**/*"
],
"scripts": {
"dev": "webpack watch --mode development",
"build": "webpack --mode production",
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"dependencies": {
"byte-base64": "^1.1.0",
"fetch-retry": "^6.0.0",
"jest": "^29.7.0",
"openapi-fetch": "0.13.4",
"openapi-typescript": "7.6.1",
"p-queue": "^8.1.0",
"sync_lib": "file:../../backend/sync_lib/pkg",
"uuid": "^11.1.0"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.13.5",
"jest": "^29.7.0",
"ts-jest": "^29.2.6",
"ts-loader": "^9.5.2",
"tslib": "2.8.1",
"typescript": "5.7.3",
"uuid": "^11.1.0",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1"
"webpack-cli": "^6.0.1",
"webpack-merge": "^6.0.1",
"sync_lib": "file:../../backend/sync_lib/pkg"
}
}

View file

@ -1,6 +1,7 @@
const path = require("path");
const { merge } = require("webpack-merge");
module.exports = (_env, _argv) => ({
const common = {
entry: "./src/index.ts",
module: {
rules: [
@ -27,15 +28,29 @@ module.exports = (_env, _argv) => ({
},
performance: {
hints: false // it's a library, no need to warn about its size
},
output: {
clean: true,
filename: "index.js",
globalObject: "this",
library: {
name: "SyncClient",
type: "umd"
},
path: path.resolve(__dirname, "dist")
}
});
};
module.exports = [
merge(common, {
target: "web",
output: {
path: path.resolve(__dirname, "dist"),
filename: "sync-client.web.js",
library: {
name: "SyncClient",
type: "umd",
export: "default"
},
globalObject: "this"
}
}),
merge(common, {
target: "node",
output: {
path: path.resolve(__dirname, "dist"),
filename: "sync-client.node.js",
libraryTarget: "commonjs2"
}
})
];