unjs / unbuild

📦 A unified JavaScript build system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsdoc

coderbaozi opened this issue · comments

Describe the feature

Please tell me how to configure it so that jsdoc can be retained during packaging.

Additional information

  • Would you be willing to help implement this feature?

config
export default defineBuildConfig({
entries: [
'src/index',
'src/cli/index',
],
declaration: true,
clean: true,
rollup: {
emitCJS: true,
},
})

@coderbaozi because unbuild uses esbuild for bundling, I don't think there a global way to retain JSDoc comments.

What you can do, is to add the @preserve tag to those comment blocks you want to keep. For example:

/**
 * A log Function
 * @param  {...any} args Arguments to log
 * @returns {void}
 * @preserve
 */
export const log = (...args) => {
  console.log(...args);
};