bwip-js
bwip-js copied to clipboard
(imported as 'toCanvas') was not found in 'bwip-js'
Error Angular 14
No way to understand what is wrong since you provided nothing in terms of example code or how to replicate....
hola,
cuando intentento utilizar la libreria en Angular 14, salta este error:

Based on the extended error message, you are using a named import. The toCanvas() is part of the default exports from bwip-js.
See the README at Browser ES6 Module Usage and call as bwipjs.toCanvas().
hello, I read and performed the documentation steps, but the same error follows, is this library compatible with angular v14?
Do you understand the difference between default and named imports? Use: import bwipjs from 'bwip-js'; Do not put curly braces around anything in the import statement. Then invoke as bwipjs.toCanvas(). It would save a lot of time if you just post your code rather than me trying to guess what you are doing wrong.
Me funciono, el problema era el siguiente: export = BwipJs; y me mostraba el siguiente error: 99 export = BwipJs; ~~~~~~~~~~~~~~~~ This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag. entonces cambie esto export = BwipJs por export default BwipJS en el index.d.ts del bwip-js y funciono a la perfeccion. Disculpa por las molestias ocaciondas y gracias el buen trabajo que usted hace. XD
Show your code! Including the import statement. I cannot help you any further without it. The screen capture you posted does not show the import statement.
import { Component, OnInit } from '@angular/core';
import bwipjs from "bwip-js";
de todas formas, me funciona, cuando realice el cambio.
@metafloor Hi!
Why does toCanvas have to be part of the default export and not a separate method? Is it possible to import it separately to reduce bundle size?
toCansas() is a generic method and links to all exports in BWIPP. That is why we have a separate named export for each encoder.