We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
toString()
1 parent 7ca3aa5 commit 3bb4de2Copy full SHA for 3bb4de2
packages/lqip-loader/src/index.ts
@@ -48,7 +48,11 @@ export default async function lqipLoader(
48
try {
49
const preSrc = await lqip.base64(imgPath);
50
const finalObject = JSON.stringify({src: 'STUB', preSrc});
51
- const result = `module.exports = ${finalObject.replace('"STUB"', source)};`;
+ // Caller of toString() will need the original source
52
+ const result = `module.exports = Object.assign(Object.create({toString(){return this.src.toString();}}),${finalObject.replace(
53
+ '"STUB"',
54
+ source,
55
+ )});`;
56
callback(null, result);
57
} catch (err) {
58
console.error(err);
0 commit comments