Socket
Book a DemoInstallSign in
Socket

@apeleghq/esbuild-plugin-inline-js

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apeleghq/esbuild-plugin-inline-js

esbuild plugin for inline scripts

latest
Source
npmnpm
Version
1.1.13
Version published
Maintainers
2
Created
Source

esbuild plugin for inline scripts

Reliability Rating Vulnerabilities Bugs Security Rating Maintainability Rating NPM Downloads

How to use

Installing

npm i -D @apeleghq/esbuild-plugin-inline-js

Configuring esbuild

In the file you have your configuration, first import this plugin

const inlineJs = require('@apeleghq/esbuild-plugin-inline-js');

Or using ES module syntax:

import inlineJs from '@apeleghq/esbuild-plugin-inline-js';

Then, in your esbuild configuration, add inlineJs() to the plugins list. inlineJs optionally takes an object that is passed to esbuild.build, with the exception of the following keys: entryPoints, outdir, outfile and write. Minimal example:

const esbuild = require('esbuild');
const responsiveImages = require('@apeleghq/esbuild-plugin-inline-js');

await esbuild
	.build({
		entryPoints: ['index.js'],
		outdir: 'build',
		bundle: true,
		format: 'cjs',
		plugins: [inlineJs()],
	});

Getting inline scripts

Import your inline scripts like this (the extensions supported are inline.js, inline.jsx, inline.ts and inline.tsx):

const inline = require('./foo.inline.js');
// import * as inline from './foo.inline.js';

Result

The import will return something like this:

{
	"contentBase64":
		"KGZ1bmN0aW9uKCl7cmV0dXJuIkhlbGxvLCBXb3JsZCEifSkoKTsK",
	"default":
		"(function(){return\"Hello, World!\"})();\n",
	"sri": "sha384-PKTF85dF3CsFYaS3tntysCSCAPJBKTcMWuzUmxBG0MTrEJMfMFeNSUo+KQGaqzp3"
}

Keywords

esbuild

FAQs

Package last updated on 11 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts