| Crates.io | brk_rolldown_plugin_data_uri |
| lib.rs | brk_rolldown_plugin_data_uri |
| version | 0.1.5 |
| created_at | 2025-06-14 23:12:42.158814+00 |
| updated_at | 2025-09-08 16:58:26.025128+00 |
| description | brk fork of rolldown_plugin_data_uri |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1712742 |
| size | 76,327 |
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.
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.
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(msg); // -> 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 { defineConfig } from 'rolldown';
export default defineConfig({
input: './index.js',
moduleTypes: {
'.png': 'dataurl',
},
});
It will yield
// #region example.png
var example_default$12 = 'data:image/png,png';
// #endregion