grafana/scripts/webpack/loaders/blobUrl.js

9 lines
297 B
JavaScript

const loaderUtils = require('loader-utils');
module.exports = function blobUrl(source) {
const { type } = loaderUtils.getOptions(this) || {};
return `module.exports = URL.createObjectURL(new Blob([${JSON.stringify(source)}]${
type ? `, { type: ${JSON.stringify(type)} }` : ''
}));`;
};