From 195d7597a9fe74db73fd21dbb7f01fed7c56213c Mon Sep 17 00:00:00 2001 From: Peter Somogyvari Date: Sat, 16 May 2020 23:53:29 -0700 Subject: [PATCH] build(webpack): introduce index.web.ts to allow separate exports per platform (NodeJS vs Browser) This implicitly solves the issue of having webpack bundling issues when the browser build has node only APIs pulled in such as an HTTP server. Signed-off-by: Peter Somogyvari --- packages/cactus-cmd-api-server/src/main/typescript/index.web.ts | 1 + packages/cactus-common/src/main/typescript/index.web.ts | 1 + packages/cactus-core-api/src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + packages/cactus-sdk/src/main/typescript/index.web.ts | 1 + .../src/main/typescript/index.web.ts | 1 + packages/cactus-test-tooling/src/main/typescript/index.web.ts | 1 + webpack.dev.web.js | 2 +- webpack.prod.web.js | 2 +- 13 files changed, 13 insertions(+), 2 deletions(-) create mode 100755 packages/cactus-cmd-api-server/src/main/typescript/index.web.ts create mode 100755 packages/cactus-common/src/main/typescript/index.web.ts create mode 100755 packages/cactus-core-api/src/main/typescript/index.web.ts create mode 100755 packages/cactus-plugin-keychain-memory/src/main/typescript/index.web.ts create mode 100755 packages/cactus-plugin-kv-storage-memory/src/main/typescript/index.web.ts create mode 100755 packages/cactus-plugin-ledger-connector-besu/src/main/typescript/index.web.ts create mode 100755 packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts create mode 100755 packages/cactus-plugin-web-service-consortium/src/main/typescript/index.web.ts create mode 100755 packages/cactus-sdk/src/main/typescript/index.web.ts create mode 100755 packages/cactus-test-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts create mode 100755 packages/cactus-test-tooling/src/main/typescript/index.web.ts diff --git a/packages/cactus-cmd-api-server/src/main/typescript/index.web.ts b/packages/cactus-cmd-api-server/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-cmd-api-server/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-common/src/main/typescript/index.web.ts b/packages/cactus-common/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..87cb558397 --- /dev/null +++ b/packages/cactus-common/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cactus-core-api/src/main/typescript/index.web.ts b/packages/cactus-core-api/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..87cb558397 --- /dev/null +++ b/packages/cactus-core-api/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/index.web.ts b/packages/cactus-plugin-keychain-memory/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-plugin-kv-storage-memory/src/main/typescript/index.web.ts b/packages/cactus-plugin-kv-storage-memory/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-plugin-kv-storage-memory/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/index.web.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-plugin-web-service-consortium/src/main/typescript/index.web.ts b/packages/cactus-plugin-web-service-consortium/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..bdf54028d2 --- /dev/null +++ b/packages/cactus-plugin-web-service-consortium/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export * from "./generated/openapi/typescript-axios/index"; diff --git a/packages/cactus-sdk/src/main/typescript/index.web.ts b/packages/cactus-sdk/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..87cb558397 --- /dev/null +++ b/packages/cactus-sdk/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export * from "./public-api"; diff --git a/packages/cactus-test-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts b/packages/cactus-test-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-test-plugin-ledger-connector-quorum/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/cactus-test-tooling/src/main/typescript/index.web.ts b/packages/cactus-test-tooling/src/main/typescript/index.web.ts new file mode 100755 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/cactus-test-tooling/src/main/typescript/index.web.ts @@ -0,0 +1 @@ +export {}; diff --git a/webpack.dev.web.js b/webpack.dev.web.js index e674a73245..adee182ec5 100644 --- a/webpack.dev.web.js +++ b/webpack.dev.web.js @@ -8,7 +8,7 @@ const libraryName = `${packageNameNoScope}`; module.exports = { entry: { - [pkg.browser]: `${packageDir}/src/main/typescript/index.ts`, + [pkg.browser]: `${packageDir}/src/main/typescript/index.web.ts`, }, mode: "development", devtool: "inline-source-map", diff --git a/webpack.prod.web.js b/webpack.prod.web.js index 172f9ab9cc..1e832f75dc 100644 --- a/webpack.prod.web.js +++ b/webpack.prod.web.js @@ -9,7 +9,7 @@ const libraryName = `${packageNameNoScope}`; module.exports = { entry: { - [pkg.browserMinified]: `${packageDir}/src/main/typescript/index.ts`, + [pkg.browserMinified]: `${packageDir}/src/main/typescript/index.web.ts`, }, mode: "production", devtool: "source-map",