🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
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-2023185232
tags-support
Source
npm
Version published
Weekly downloads
5.7K
-11.58%
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 08 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