github / webauthn-json

🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.
https://github.github.com/webauthn-json/demo/
MIT License
757 stars 60 forks source link

Bundling errors under yarn3 after upgrade from `0.5.7` to `0.6.2` #53

Closed kubijo closed 2 years ago

kubijo commented 2 years ago
$ yarn dlx -q envinfo --preset jest

  System:
    OS: Linux 5.11 Ubuntu 21.10 21.10 (Impish Indri)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
  Binaries:
    Node: 16.13.1 - /tmp/xfs-705ba6ea/node
    Yarn: 3.2.0-rc.5 - /tmp/xfs-705ba6ea/yarn
$ yarn why @github/webauthn-json
└─ xxx@packages/xxx
   └─ @github/webauthn-json@npm:0.6.2 (via npm:0.6.2)
webpack@npm:5.66.0
typescript@patch:typescript@npm%3A4.5.4#~builtin<compat/typescript>::version=4.5.4&hash=493e53
ERROR in ./packages/xxx/lib/fido.tsx 17:0-46
Module not found: Error: Can't resolve '@github/webauthn-json' in '/path/to/packages/xxx/lib'
resolve '@github/webauthn-json' in '/path/to/packages/xxx/lib'
  Parsed request is a module
  using description file: /path/to/packages/xxx/package.json (relative path: ./lib)
    Field 'browser' doesn't contain a valid alias configuration
    resolve as module
      resolved by pnp to /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/
        using description file: /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/package.json (relative path: .)
          using exports field: ./dist/webauthn-json.js
            using description file: /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/package.json (relative path: ./dist/webauthn-json.js)
              no extension
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js doesn't exist
              .ts
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.ts doesn't exist
              .tsx
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.tsx doesn't exist
              .js
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.js doesn't exist
              .mjs
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.mjs doesn't exist
              .cjs
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.cjs doesn't exist
              .ejs
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.ejs doesn't exist
              .jsx
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.jsx doesn't exist
              .json
                Field 'browser' doesn't contain a valid alias configuration
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js.json doesn't exist
              as directory
                /path/to/.yarn/cache/@github-webauthn-json-npm-0.6.2-4bf1caaf04-a10c7a9e5a.zip/node_modules/@github/webauthn-json/dist/webauthn-json.js doesn't exist
lgarron commented 2 years ago

Do you have documentation on what yarn expects?

We only have one main build, and it's listed as main as well as in exports.

kubijo commented 2 years ago

Nope... Given that I have not yet worked on any package distributed on NPM, I can't say much from the top of my head.

arcanis commented 2 years ago

The exports field in https://cdn.jsdelivr.net/npm/@github/webauthn-json@0.6.4/package.json references an invalid file (presumably you forgot the esm folder in ./dist/webauthn-json.js, same for ./dist/webauthn-json.extended.js).

dartess commented 2 years ago

Same problem without using yarn. Webpack build fails to resolve the dependency.

lgarron commented 2 years ago

The exports field in https://cdn.jsdelivr.net/npm/@github/webauthn-json@0.6.4/package.json references an invalid file (presumably you forgot the esm folder in ./dist/webauthn-json.js, same for ./dist/webauthn-json.extended.js).

Aha! Thanks, that would explain it. This kind of stuff makes me really grumbly that this still needs to be done by hand. 😆

lgarron commented 2 years ago

Alright, please let me know if v0.6.5 works for you!

dartess commented 2 years ago

in my case everything worked. thanks!

kubijo commented 2 years ago

Yep, working fine :+1: