papnkukn / qrcode-svg

A simple QR Code generator in pure JavaScript / node.js library
MIT License
451 stars 93 forks source link

Use `eval('require')` instead of `require` to avoid bundler error #20

Open hzy opened 3 years ago

hzy commented 3 years ago

Use eval('require') instead of require to avoid bundler error.

This allow this package continue work with Node.js and can avoid a bundler error.

This PR fixes papnkukn/qrcode-svg#11

hzy commented 3 years ago

@papnkukn Would u PTAL :) ?

aralroca commented 2 years ago

I think make sense to avoid Webpack errors

trasherdk commented 1 year ago

It makes more sense to avoid eval() at any cost.

Tofandel commented 1 year ago

Can't we provide a build for browsers without the save function and one for node?

NPM provides the feature to automatically import the correct version using

"exports": {
    "browser": {
      "default": "./qrcode.browser.min.js",
    },
    "default": "./qrcode.min.js",
}