You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
550 B
26 lines
550 B
2 years ago
|
const MARKER = "my-special-import";
|
||
|
module.exports = (config, outputOptions, omt) => {
|
||
|
config.plugins = [
|
||
|
omt(),
|
||
|
{
|
||
|
resolveId(id) {
|
||
|
if (id !== MARKER) {
|
||
|
return;
|
||
|
}
|
||
|
return id;
|
||
|
},
|
||
|
load(id) {
|
||
|
if (id !== MARKER) {
|
||
|
return;
|
||
|
}
|
||
|
const referenceId = this.emitFile({
|
||
|
type: "asset",
|
||
|
name: "my-asset.bin",
|
||
|
source: "assetcontent"
|
||
|
});
|
||
|
return `export default import.meta.ROLLUP_FILE_URL_${referenceId}`;
|
||
|
}
|
||
|
}
|
||
|
];
|
||
|
};
|