You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

virtual-resource-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-resource-loader

Create new files inside a webpack compilation, without a file existing on disk

0.0.0-tags-support-2023174816
Source
npmnpm
Version published
Weekly downloads
5.3K
-0.69%
Maintainers
1
Weekly downloads
 
Created
Source

virtual-resource-loader

virtual-resource-loader allows you to create new modules inside a webpack compilation, without a file existing on disk. This is achieved in combination with webpack's matchResource feature.

Usage

// example-loader.js
export default exampleLoader() {
  const virtualModuleSourceCode = '...';

  const base64Source = Buffer.from(JSON.stringify(virtualModuleSourceCode), 'utf-8').toString(
    'base64',
  );

  const request = `./my-virtual-file!=!virtual-resource-loader?source=${base64Source}!${loader.resourcePath}`;

  return `
    import ${request};
  `;
}

FAQs

Package last updated on 07 Feb 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