From d6d51de048cab6eed4b46f9d24aeeebc2f04c416 Mon Sep 17 00:00:00 2001 From: Damian Nunez Rodriguez Date: Wed, 15 Jul 2026 12:04:27 -0300 Subject: [PATCH] fix: support legacy inline resolution --- inline.js | 1 + lib/esbuild.config.js | 16 +++++++++++++--- package.json | 7 +++++-- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 inline.js diff --git a/inline.js b/inline.js new file mode 100644 index 0000000..024a6c5 --- /dev/null +++ b/inline.js @@ -0,0 +1 @@ +export { default } from './dist/inline.js'; diff --git a/lib/esbuild.config.js b/lib/esbuild.config.js index 9376733..adfaadc 100644 --- a/lib/esbuild.config.js +++ b/lib/esbuild.config.js @@ -103,17 +103,27 @@ if (WATCH) { ] }); - // Build the modern browser bundle as importable string - await build({ + // Build the modern browser bundle as importable strings + const inlineConfig = { entryPoints: [resolve(DIST, 'browser.js')], loader: { '.js': 'text', }, - format: 'esm', minify: true, + }; + + await build({ + ...inlineConfig, + format: 'esm', outfile: resolve(DIST, 'inline.js'), }); + await build({ + ...inlineConfig, + format: 'cjs', + outfile: resolve(DIST, 'inline.cjs'), + }); + // Transform to ES5 const transformedESM = await swc.transformFile(resolve(DIST, 'index.mjs'), swcOptions); diff --git a/package.json b/package.json index e477617..61377b6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hcaptcha/loader", "description": "This is a JavaScript library to easily configure the loading of the hCaptcha JS client SDK with built-in error handling.", - "version": "2.4.0", + "version": "2.4.1", "author": "hCaptcha team and contributors", "license": "MIT", "keywords": [ @@ -23,11 +23,14 @@ }, "./inline": { "types": "./dist/types/src/inline.d.ts", - "import": "./dist/inline.js" + "import": "./dist/inline.js", + "require": "./dist/inline.cjs", + "default": "./dist/inline.js" } }, "files": [ "README.md", + "inline.js", "dist", "!**/*.tsbuildinfo" ],