Maintenance Guide
A plugin for rolldown-vite that enables loading data: URIs as modules, ported from Vite's dataUriPlugin.
This plugin is exclusive to rolldown-vite and is not recommended for external use.
📦 What it does
This plugin enables native support for data: URLs in JavaScript, CSS, and JSON contexts by resolving and loading them as virtual modules.
Supported MIME types:
-
text/css→ loaded as CSS module -
text/javascript→ loaded as JS module -
application/json→ loaded as JSON module
Other MIME types are ignored and fall back to default behavior.
🚀 Debug Usage
This plugin is enabled by default in rolldown, so no manual configuration is required.
import msg from 'data:text/javascript,export default "hello from data URI"';
console.log; // -> hello from data URI
If you want to specify the type of module, you can define 'module_ext': module_type. For example, if you want to import files with ext .png as dataurl module.
import from 'rolldown';
export default ;
It will yield
// #region example.png
var example_default$12 = 'data:image/png,png';
// #endregion