Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions inline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './dist/inline.js';
16 changes: 13 additions & 3 deletions lib/esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand All @@ -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"
],
Expand Down
Loading