c1rrus/svg-fill

TypeError: SvgFill is not a constructor

Closed this issue · 2 comments

When running the example from the readme, I get this error:

TypeError: SvgFill is not a constructor
    at Object.<anonymous> (/path/to/script.js:3:21)
    at Module._compile (internal/modules/cjs/loader.js:1176:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
    at Module.load (internal/modules/cjs/loader.js:1040:32)
    at Function.Module._load (internal/modules/cjs/loader.js:929:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47

Working example:

const SvgFill = require('svg-fill').default; // needs .default

const svgFill = new SvgFill('#FF0000');
const originalSvgData = '<svg>....</svg>';
const coloredSvgData = svgFill.fillSvg(originalSvgData);

(Node v14.2.0)

same here

node v16.13.1

Thanks for pointing this out!

I've just updated the code examples in the README to add the missing .default.

Sorry for not fixing this sooner!