erwanvivien / fast_qr

Ultra fast QRCode generation
https://fast-qr.com/
MIT License
197 stars 29 forks source link

No "main" entry in package.json #59

Closed shalugin closed 2 months ago

shalugin commented 2 months ago

Hi. Why is there no main entry in the package.json file? Some tools consider it as an error:

Error: Failed to resolve entry for package "fast_qr". The package may have incorrect main/module/exports specified in its package.json.

https://www.npmjs.com/package/fast_qr?activeTab=code

{
  "name": "fast_qr",
  "collaborators": [
    "erwan.vivien <erwan.vivien@epita.fr>"
  ],
  "description": "Generates optimized QRCode",
  "version": "0.12.1",
  "license": "SEE LICENSE IN LICENSE",
  "repository": {
    "type": "git",
    "url": "https://github.com/erwanvivien/fast_qr/"
  },
  "files": [
    "fast_qr_bg.wasm",
    "fast_qr.js",
    "fast_qr.d.ts"
  ],
  "module": "fast_qr.js",
  "homepage": "https://fast-qr.com/",
  "types": "fast_qr.d.ts",
  "sideEffects": false,
  "keywords": [
    "qr",
    "qrcode",
    "qr-generator",
    "qrcode-generator",
    "qr-gen"
  ]
}
erwanvivien commented 2 months ago

Hey thanks for the report!

I'm not sure why there isn't 🤔 wasm-bindgen is the one creating this file, maybe I should add a main entry by hand then! Just to be sure, the main entry would be "fast_qr.js"?

erwanvivien commented 2 months ago

By the way, which tool are you using? I didn't have a problem with NPM 🤔

shalugin commented 2 months ago

This error message was issued by vitest (https://vitest.dev /). I fixed it as follows (`vite.config.ts'):

      {
        find: /^fast_qr$/,
        replacement: __dirname + '/node_modules/fast_qr/fast_qr.js',
      },
shalugin commented 2 months ago

Hey thanks for the report!

I'm not sure why there isn't 🤔 wasm-bindgen is the one creating this file, maybe I should add a main entry by hand then! Just to be sure, the main entry would be "fast_qr.js"?

Yes)

erwanvivien commented 2 months ago

It should be fixed in https://www.npmjs.com/package/fast_qr/v/0.12.5?activeTab=code

shalugin commented 2 months ago

Thanks for the quick fix!