Comments (5)
@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.
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.
@undecaf working, thanks. I was able to get consistent results as in 0.9.15
.
from zbar-wasm.
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.
@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)
- big images cannot be scanned succesfully, in the first attempt. HOT 7
- How to bundle zbar.wasm in a module project? HOT 6
- The barcode type DataMatrix is not supported HOT 1
- Please Help : Why i show this error when i tray import the package in Angular 16 HOT 1
- Build fails when using in Next.js App directory router. HOT 2
- __dirname is not defined with nextjs HOT 1
- Paused when failed to detect unsupported code type. HOT 2
- zbar-wasm doesn't work with nodejs 18
- TypeError: Failed to construct 'URL': Invalid URL HOT 5
- Issue with utf-8 HOT 13
- after 15 june this package giving an error HOT 2
- loading zbar-wasm as ES module fails in Node HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zbar-wasm.