Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bundle-require

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bundle-require

bundle and require a file

  • 4.0.2
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by1.05%
Maintainers
1
Weekly downloads
 
Created

What is bundle-require?

The bundle-require npm package allows you to require modules that are bundled using various bundlers like Webpack, Rollup, or esbuild. It simplifies the process of loading and executing bundled code in Node.js environments.

What are bundle-require's main functionalities?

Require Bundled Code

This feature allows you to require a bundled JavaScript file using a specified bundler. In this example, the bundled file is loaded using Webpack.

const { bundleRequire } = require('bundle-require');

(async () => {
  const result = await bundleRequire({
    filepath: './path/to/your/bundled/file.js',
    bundler: 'webpack'
  });
  console.log(result);
})();

Support for Multiple Bundlers

This feature demonstrates the ability to use different bundlers like Rollup. The bundler option can be changed to 'webpack', 'rollup', or 'esbuild' based on your needs.

const { bundleRequire } = require('bundle-require');

(async () => {
  const result = await bundleRequire({
    filepath: './path/to/your/bundled/file.js',
    bundler: 'rollup'
  });
  console.log(result);
})();

Dynamic Import of Bundled Code

This feature shows how to dynamically import a bundled module using esbuild. The default export of the bundled module is accessed and logged.

const { bundleRequire } = require('bundle-require');

(async () => {
  const result = await bundleRequire({
    filepath: './path/to/your/bundled/file.js',
    bundler: 'esbuild'
  });
  const { default: module } = result;
  console.log(module);
})();

Other packages similar to bundle-require

FAQs

Package last updated on 25 Sep 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc