'This dependency was not found - Nuxt - Multiple entrypoint module

I have a module with multiple entrypoints. This is its package.json:

{
    "name": "mymodule"
    "main": "dist/index.js",
    "exports": {
        ".": "./dist/index.js",
        "./client": "./dist/client.js"
    }
    ...
}

When I try to import it in a Nuxt file:

// [~nuxtSrcDir]/pages/index.js

import mymodule from 'mymodule/client';

...

and I run

yarn nuxt dev

I get:

This dependency was not found:
                               
* mymodule/client in ./dist/pages/index.js

Is this a webpack issue? Why I can't import the module from a secondary entrypoint?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source