diff --git a/doc-kit.config.mjs b/doc-kit.config.mjs index 70ca4c9..6a7c8d2 100644 --- a/doc-kit.config.mjs +++ b/doc-kit.config.mjs @@ -1,3 +1,8 @@ +import { resolve, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + /** * Configuration for @node-core/doc-kit when generating webpack API docs. * @@ -18,6 +23,13 @@ export default { web: { // Use "webpack" as the product name in navbar and sidebar labels title: 'webpack', + + // Override the default Node.js theming components with webpack-specific ones. + // These aliases are resolved by the bundler during the doc-kit build step. + // @see https://github.com/nodejs/doc-kit/issues/665 + imports: { + '#theme/Logo': resolve(__dirname, './ui/WebpackLogo.jsx'), + }, }, 'jsx-ast': { // Disable the "Edit this page" link — webpack API docs are generated from diff --git a/package.json b/package.json index 029a5c9..14b9f7e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "prepare": "husky" }, "dependencies": { - "@node-core/doc-kit": "^1.2.0", + "@node-core/doc-kit": "^1.2.1", "semver": "^7.7.4", "typedoc": "^0.28.18", "typedoc-plugin-markdown": "^4.11.0", diff --git a/ui/WebpackLogo.jsx b/ui/WebpackLogo.jsx new file mode 100644 index 0000000..42f291a --- /dev/null +++ b/ui/WebpackLogo.jsx @@ -0,0 +1,35 @@ +/** + * Webpack logo component for use as the #theme/Logo override. + * Based on the official webpack brand assets. + * @see https://webpack.js.org + */ +const WebpackLogo = props => ( + + + + + + +); + +export default WebpackLogo;