November Perfect Moustache

    virtual-resource-loader
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    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};
      `;
    }

    Keywords

    none

    Install

    npm i virtual-resource-loader

    DownloadsWeekly Downloads

    2,644

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    2.67 kB

    Total Files

    9

    Last publish

    Collaborators

    • seek-oss-ci