Skip to content

Latest commit

 

History

History

plugin-virtual-module

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

rspack-plugin-virtual-module

A plugin for rspack that allows you to create virtual modules.

Installation

# npm
npm install rspack-plugin-virtual-module
# yarn
yarn add rspack-plugin-virtual-module
# pnpm
pnpm add rspack-plugin-virtual-module

Usage

const { RspackVirtualModulePlugin } = require('rspack-plugin-virtual-module');
// rspack.config.js
module.exports = {
  plugins: [
    new RspackVirtualModulePlugin({
      contents: 'export default "Hello World";',
    }),
  ],
};

Then you can import the virtual module in your code:

import hello from 'contents';

console.log(hello); // "Hello World"