How to specify Conditional Exports?

When a project imports an npm library using Conditional Exports, it looks that forge deploy lets Webpack refer to the browser-variant location.

For example, with the sample project GitHub - ymkjp/forge-20210530, it shows the following error when packaging app files:

$ forge --version
1.3.4
$ forge deploy
...
Field 'browser' doesn't contain a valid alias configuration

^ the full output is available at README.md.

This is seemingly because the imported library has the following exports configuration in package.json:

    "./jwk/parse": {
      "browser": "./dist/browser/jwk/parse.js",
      "import": "./dist/node/esm/jwk/parse.js",
      "require": "./dist/node/cjs/jwk/parse.js"
    },

ref. jose/package.json at 34ee14955f3c5d5215b6eeeae315bf271cf9dd55 · panva/jose · GitHub

Is there any way to let the deployment command refer to the import-variant location?

Hi @i05 ,

Is this the same as this stackoverflow issue?

Regards,
Dugald

Thanks, making an alias like below solved the packaging error per se.

    "jose": "file:./node_modules/jose-node-esm-runtime/dist/node/esm/",
    "jose-node-esm-runtime": "^3.12.2",

Diff: Added workaround · ymkjp/forge-20210530@3391096 · GitHub

Considering Forge is a FaaS platform, I think the deploy command better to select the node (ESM, CJS) variant by default.