ericblade / quagga2

An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
MIT License
761 stars 85 forks source link

Future issue: upgrade from webpack v4 to v5 #88

Closed ericblade closed 2 years ago

ericblade commented 4 years ago

Now that we've had v4 webpack for a few minutes, there's a beta version of webpack v5 that we could migrate to: https://webpack.js.org/migrate/5/

As this requires a bump to node v10, I think we should do this whenever we do the next major version bump

ericblade commented 4 years ago

This presently, with beta 15, results in:

ERROR in ./node_modules/get-pixels/dom-pixels.js 3:11-26
Module not found: Error: Can't resolve 'path' in 'C:\src\quagga2\node_modules\get-pixels'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need these module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add an alias 'resolve.alias: { "path": "path-browserify" }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.alias: { "path": false }
 @ ./src/input/input_stream_node.js 1:16-37
 @ ./src/input/input_stream.js 1:0-50 348:0-27
 @ ./src/quagga/quagga.ts 10:0-76 18:50-65 18:68-86
 @ ./src/quagga.js 12:0-37 13:19-25 75:29-35

ERROR in ./node_modules/through/index.js 1:13-30
Module not found: Error: Can't resolve 'stream' in 'C:\src\quagga2\node_modules\through'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need these module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add an alias 'resolve.alias: { "stream": "stream-browserify" }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.alias: { "stream": false }
 @ ./node_modules/get-pixels/dom-pixels.js 11:14-32
 @ ./src/input/input_stream_node.js 1:16-37
 @ ./src/input/input_stream.js 1:0-50 348:0-27
 @ ./src/quagga/quagga.ts 10:0-76 18:50-65 18:68-86
 @ ./src/quagga.js 12:0-37 13:19-25 75:29-35

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ericblade/quagga2@1.0.2 build:dev: `npx cross-env BUILD_ENV=development webpack --config configs/webpack.config.js`
npm ERR! Exit status 2

Following the supplied instructions does not solve the errors. Will re-explore when webpack 5 is out of beta, I think

ericblade commented 3 years ago

it might be possible that webpack v5 will build correctly now that we are no longer building unused node code into the browser bundle and vice versa

ericblade commented 3 years ago

I think webpack v5 is out of beta, and would love to get the latest and greatest working.

ericblade commented 2 years ago

fixed in 2.0 branch