aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/thirdPartyContentPlugin.ts
blob: d2da4ab6cd0357c07204e6321438467412ae0b2c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Copyright (c) 2024 Kristóf Marussy <kristof@marussy.com>
 *
 * SPDX-License-Identifier: MIT
 */

import path from 'node:path';

import type { LoadContext, Plugin } from '@docusaurus/types';

export default function thirdPartyContentPlugin({
  siteDir,
}: LoadContext): Plugin {
  const thirdPartyDir = path.join(siteDir, 'third-party');
  return {
    name: 'marussy-third-party-content-plugin',
    configureWebpack: () => ({
      mergeStrategy: {
        'resolve.alias.@site': 'replace',
      },
      resolve: {
        alias: {
          '@site': [thirdPartyDir, siteDir],
        },
      },
    }),
  };
}