Giter Site home page Giter Site logo

Comments (5)

undecaf avatar undecaf commented on May 20, 2024 2

@borracciaBlu This appears to be the same situation as above: main.js is the ESM build of zbar-wasm without polyfills for the Node dependencies such as module and fs. If targeting a browser with ESM, these dependencies cannot be resolved.

Declaring module and/or fs as external for your bundler should solve the problem for now. In a browser environment, the code referencing module and fs in zbar-wasm is dead code anyway.

I am sorry for this mess in 0.9.16, and I am working on cleaning up the package structure and providing more bundling hints in the docs.

from zbar-wasm.

undecaf avatar undecaf commented on May 20, 2024 1

As a response to #9, I removed the Node polyfills from the ES module of zbar-wasm in 0.9.16 beause e.g. require() was polyfilled with an empty method; this caused loading of zbar-wasm as an ES module to fail in Node.

On the other side, it appears that you intend to use zbar-wasm as an ES module in a browser. The build with 0.9.16 fails because module is no longer polyfilled.

As for now, including module in your Webpack externals should solve the problem. The next version of zbar-wasm (which I am preparing) will include separate ES modules for Node and for browsers.

from zbar-wasm.

borracciaBlu avatar borracciaBlu commented on May 20, 2024 1

@undecaf working, thanks. I was able to get consistent results as in 0.9.15.

from zbar-wasm.

borracciaBlu avatar borracciaBlu commented on May 20, 2024

Similar issue here using next.

with 0.9.15 worked like a charm.
After the update to 0.9.16 i've got the following error:

./node_modules/@undecaf/zbar-wasm/dist/main.js
Module not found: Can't resolve 'module'

Please consider i did use the import syntax

import { scanImageData } from '@undecaf/zbar-wasm';

instead if i use require:

const { scanImageData } = require('@undecaf/zbar-wasm');

i've got:

./node_modules/@undecaf/zbar-wasm/dist/main.cjs
Module not found: Can't resolve 'fs'

from zbar-wasm.

undecaf avatar undecaf commented on May 20, 2024

@dbo, @borracciaBlu zbar-wasm v0.10.0 should resolve this, although a different bundler configuration may be necessary.

Please feel free to re-open.

from zbar-wasm.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.