Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement NodePolyfillPlugin in theme webpack config #422

Merged
merged 2 commits into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/docusaurus-theme-openapi-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"file-saver": "^2.0.5",
"immer": "^9.0.7",
"lodash": "^4.17.20",
"node-polyfill-webpack-plugin": "^2.0.1",
"process": "^0.11.10",
"react-live": "^3.1.1",
"react-magic-dropzone": "^1.0.1",
Expand Down
16 changes: 3 additions & 13 deletions packages/docusaurus-theme-openapi-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import path from "path";

import type { Plugin } from "@docusaurus/types";
import { ProvidePlugin } from "webpack";

const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");

export default function docusaurusThemeOpenAPI(): Plugin<void> {
return {
Expand All @@ -29,18 +30,7 @@ export default function docusaurusThemeOpenAPI(): Plugin<void> {

configureWebpack() {
return {
plugins: [
new ProvidePlugin({
Buffer: [require.resolve("buffer/"), "Buffer"],
process: require.resolve("process/browser"),
}),
],
resolve: {
fallback: {
buffer: require.resolve("buffer/"),
process: require.resolve("process/browser"),
},
},
plugins: [new NodePolyfillPlugin()],
};
},
};
Expand Down
Loading