Skip to content

Commit 4cef180

Browse files
committed
add faker shim to prevent runtime errors
1 parent 9ee2309 commit 4cef180

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/docusaurus-theme-openapi-docs/src/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ export default function docusaurusThemeOpenAPI(): Plugin<void> {
3737
): Configuration {
3838
const { getStyleLoaders, currentBundler } = utils;
3939

40-
const fakerAlias = { "@faker-js/faker": false } as const;
40+
const fakerAlias = {
41+
"@faker-js/faker": path.resolve(
42+
__dirname,
43+
"..",
44+
"src",
45+
"shims",
46+
"faker.ts"
47+
),
48+
};
4149

4250
const ignoreFaker = new currentBundler.instance.IgnorePlugin({
4351
resourceRegExp: /^@faker-js\/faker$/,
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* ============================================================================
2+
* Copyright (c) Palo Alto Networks
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
* ========================================================================== */
7+
8+
const stub = new Proxy(
9+
{},
10+
{
11+
get: () => () => "",
12+
}
13+
);
14+
15+
export = stub;

0 commit comments

Comments
 (0)