Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

rollup/rollup-plugin-virtual

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moved

This module has moved and is now available at @rollup/plugin-virtual. Please update your dependencies. This repository is no longer maintained.

rollup-plugin-virtual

Load modules from memory.

Usage

Suppose you have an input file like this, and you want to load foo and src/bar.js from memory:

// src.main.js
import foo from 'foo';
import bar from './bar.js';

console.log(foo, bar);
// rollup.config.js
import virtual from 'rollup-plugin-virtual';

export default {
  entry: 'src/main.js',
  // ...
  plugins: [
    virtual({
      'foo': 'export default 1',
      'src/bar.js': 'export default 2'
    })
  ]
};

If there were named exports:

// src.main.js
export {foo, bar} from 'foobar';

console.log(foo, bar);
// rollup.config.js
// ...
    virtual ({
      'foobar': `
        export const foo = vendor._foobar.foo;
        export const bar = vendor._foobar.bar;
      `
    })

Use this plugin before any other one like node-resolve or commonjs so they do not alter the output.

License

MIT

About

This module has moved and is now available at @rollup/plugin-virtual / https://github.com/rollup/plugins/blob/master/packages/virtual

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •