image-encode icon indicating copy to clipboard operation
image-encode copied to clipboard

ReferenceError: document is not defined

Open liuxinyumocn opened this issue 2 years ago • 0 comments

I run in node.js and use webpack to package, but I throw an error. How can I solve it?

import fs from 'fs';
let encode = require('image-encode')

// create a file with chess pattern
fs.writeFileSync(
	'out.png',
	Buffer.from(encode([0,0,0,255, 255,255,255,255, 255,255,255,255, 0,0,0,255], [2, 2], 'png'))
)
ReferenceError: document is not defined

liuxinyumocn avatar Jan 31 '23 06:01 liuxinyumocn