diff --git a/package.json b/package.json index 0295c0421..419ec4a43 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,6 @@ "@commitlint/config-conventional": "^18.4.3", "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", - "@fal-works/esbuild-plugin-global-externals": "^2.1.2", "@ladle/react": "^0.16.0", "@playwright/test": "^1.42.1", "@semantic-release/changelog": "^6.0.2", @@ -247,5 +246,6 @@ ">0.2%", "not ie <= 11", "not op_mini all" - ] + ], + "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" } diff --git a/scripts/bundle.mjs b/scripts/bundle.mjs index c07e7b782..0caa14e60 100755 --- a/scripts/bundle.mjs +++ b/scripts/bundle.mjs @@ -3,14 +3,12 @@ import { dirname, resolve } from 'node:path'; import { fileURLToPath } from 'node:url'; import * as esbuild from 'esbuild'; -import { globalExternals } from '@fal-works/esbuild-plugin-global-externals'; // import.meta.dirname is not available before Node 20 const __dirname = dirname(fileURLToPath(import.meta.url)); const sdkEntrypoint = resolve(__dirname, '../src/index.ts'); const emojiEntrypoint = resolve(__dirname, '../src/components/Emojis/index.ts'); -const browserBundleEntrypoint = resolve(__dirname, '../src/index_UMD.ts'); const outDir = resolve(__dirname, '../dist'); // Those dependencies are distributed as ES modules, and cannot be externalized @@ -44,45 +42,4 @@ const cjsBundleConfig = { sourcemap: 'linked', }; -const browserBundleConfig = { - entryPoints: [browserBundleEntrypoint], - bundle: true, - format: 'iife', - target: 'es2020', - external: ['react', 'react-dom', 'stream-chat', '@emoji-mart'], - plugins: [ - globalExternals({ - react: { - varName: 'React', - type: 'cjs', - }, - 'react/jsx-runtime': { - varName: 'React', - type: 'cjs', - }, - 'react-dom': { - varName: 'ReactDOM', - type: 'cjs', - }, - 'stream-chat': { - varName: 'StreamChat', - type: 'cjs', - }, - }), - ], - globalName: 'StreamChatReact', - outfile: resolve(outDir, 'browser.full-bundle.js'), - sourcemap: 'linked', -}; - -const browserBundleMinConfig = { - ...browserBundleConfig, - minify: true, - outfile: resolve(outDir, 'browser.full-bundle.min.js'), -}; - -await Promise.all([ - esbuild.build(cjsBundleConfig), - esbuild.build(browserBundleConfig), - esbuild.build(browserBundleMinConfig), -]); +await esbuild.build(cjsBundleConfig); diff --git a/yarn.lock b/yarn.lock index 4c9ba890f..ed8457855 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1564,11 +1564,6 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@fal-works/esbuild-plugin-global-externals@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@fal-works/esbuild-plugin-global-externals/-/esbuild-plugin-global-externals-2.1.2.tgz#c05ed35ad82df8e6ac616c68b92c2282bd083ba4" - integrity sha512-cEee/Z+I12mZcFJshKcCqC8tuX5hG3s+d+9nZ3LabqKF1vKdF41B92pJVCBggjAGORAeOzyyDDKrZwIkLffeOQ== - "@gar/promisify@^1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"