Github Project repo: https://github.com/Fralleee/lerna-intellisense-jsdoc-vscode
I have a monorepo project with two packages (Web & API). These are linked using Lerna. The Web project imports the API package, and the API requests are documented using JSDoc.
The documentation gets loaded perfectly if the API package is released and imported from NPM.
However, if it is run locally via Lerna & Webpack dev server, the documentation is lost and only available in the local code (in the API folder).
I have tried writing the documentation using modules and namespaces and searching for different types of solutions, but none seem to work.
The JSDoc and function:
/**
* Get comments from JSON placeholder API
* @namespace API
* @module
* @param {GetCommentsRequestExample} input PostId
* @returns {Promise.<GetCommentsResponseExample>} Array of comments
*/
export const getComments = input => apiGet('https://jsonplaceholder.typicode.com/comments', input, GetCommentsRequest, GetCommentsResponse)
I can't figure out why the JSDoc works when the package is released but not when run locally.
EDIT after 2 hours of extra testing
I export everything using an index file in the API package. This index file imports everything from the package and then ships it like a single entry point.
If I define the function and JSDoc inside this index file directly, the JSDoc is available to other packages, even when run locally.
So it seems to be an issue with export -> import -> export again that messes up the JSDoc. This is not a solution since the Api-package has too much code to fit into a single file.