Library: ESM5 Build not included anymore?

Created on 4 Nov 2020  ·  8Comments  ·  Source: zxing-js/library

Just updated the package to 0.18.2 and cannot import it anymore with the path @zxing/library/esm5. Did you remove the esm5 build on purpose or was it just missed with the move to rollup?

question

All 8 comments

Removed on purpose as it didn't make that much of sense. It should be es2015 now and es6 modules should be in esm folder.

@odahcam well, I'm using it on AWS lambda which as of now only supports node 12.x, and thus I needed esm5 modules

The esm build actually has "target": "es5": https://github.com/zxing-js/library/blob/master/tsconfig.lib-esm.json

  1. The esm contains ES6 modules and ES5 "classes".
  2. The es2015 contains ES6 modules and ES6 "classes".
  3. The cjs contains commonJS compatible code.

As per this google document, esm5 (ignoring the F for Flattening) would be:

The shortened name “FESM” (pronounced “phesom”) can have a number after it such as “FESM5” or “FESM2015”. The number refers to the language level of the JavaScript inside the module. So a FESM5 file would be ESM+ES5 (import/export statements and ES5 source code).

It seems you need the esm option, which should be automatically selected by your environment when you import @zxing/library based on this setting:

https://github.com/zxing-js/library/blob/6c81a112af440cd6a4f3735c10ac35d34196f0d6/package.json#L43-L48

Although, none of them satisfies your needs? If not, what exactly esm5 modules would you need?

Sorry for the delay. So it seems to actually work now. However I do get a bunch of warnings:

NotFoundException
    at RSSExpandedReader.decodeRow2pairs (/qrcodes/node_modules/@zxing/library/cjs/core/oned/rss/expanded/RSSExpandedReader.js:86:31)
    at RSSExpandedReader.decodeRow (/qrcodes/node_modules/@zxing/library/cjs/core/oned/rss/expanded/RSSExpandedReader.js:62:59)
    at MultiFormatOneDReader.decodeRow (/qrcodes/node_modules/@zxing/library/cjs/core/oned/MultiFormatOneDReader.js:99:40)
    at _loop_1 (/qrcodes/node_modules/@zxing/library/cjs/core/oned/OneDReader.js:137:41)
    at MultiFormatOneDReader.OneDReader.doDecode (/qrcodes/node_modules/@zxing/library/cjs/core/oned/OneDReader.js:159:31)
    at MultiFormatOneDReader.OneDReader.decode (/qrcodes/node_modules/@zxing/library/cjs/core/oned/OneDReader.js:43:25)
    at MultiFormatReader.decodeInternal (/qrcodes/node_modules/@zxing/library/cjs/core/MultiFormatReader.js:194:35)
    at MultiFormatReader.decode (/qrcodes/node_modules/@zxing/library/cjs/core/MultiFormatReader.js:77:21)
    at Jimp.<anonymous> (/qrcodes/index.js:98:34)
    at Timeout._onTimeout (/qrcodes/node_modules/@jimp/core/dist/index.js:264:25) {
  message: undefined
}

That seems to be related to #367

@DKhalil I suspect it is as @slokhorst says, check out the solution here https://github.com/zxing-js/library/issues/367#issuecomment-723476412 and then comment below 😄.

Ahhh yes, it is. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenny76 picture lenny76  ·  10Comments

helloo0-0oword picture helloo0-0oword  ·  8Comments

Mazecreator picture Mazecreator  ·  10Comments

mattmahn picture mattmahn  ·  7Comments

memic84 picture memic84  ·  10Comments