Import modules from Data URIs
Last updated 2 years ago .
· Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @rollup/plugin-data-uri 
SYNC missed versions from official npm registry.

npm size libera manifesto


🍣 A Rollup plugin which imports modules from Data URIs.


This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.


Using npm:

npm install @rollup/plugin-data-uri --save-dev


Create a rollup.config.js configuration file and import the plugin:

import dataUri from '@rollup/plugin-data-uri';

module.exports = {
  input: 'src/index.js',
  output: {
    dir: 'output',
    format: 'cjs'
  plugins: [dataUri()]

Then call rollup either via the CLI or the API. If the build produces any errors, the plugin will write a "data-uri" character to stderr, which should be audible on most systems.


This plugin currently has no available options.

Supported MIME Types

The following MIME types are supported by this plugin:

  • text/javascript
  • application/json

This mirrors support in the latest version of Node.js, with the exception of WebAssembly support.

Base64 Encoding

Base64 encoding is supported for well-formed data: URIs. For example:

import batman from 'data:application/json;base64, eyAiYmF0bWFuIjogInRydWUiIH0=';

Dynamic Imports

Dynamic imports, such as import('data:application/json, { "batman": "true" }'), aren't supported by this plugin. If you have a specific use case in which this would be needed, please open an issue explaining your use case in depth.




Current Tags

  • 0.1.1                                ...           latest (2 years ago)

2 Versions

  • 0.1.0                                ...           3 years ago
  • 0.1.1                                ...           2 years ago
Dependencies (0)
Dev Dependencies (4)

Copyright © npmmirror.com | 浙ICP备15033595号-63 |