Skip to content

Commit

Permalink
Support Docusaurus Faster
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Nov 12, 2024
1 parent ea6e6a0 commit 194a6f2
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 5 deletions.
4 changes: 4 additions & 0 deletions demo/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ const config = {
},
},

future: {
experimental_faster: true,
},

presets: [
[
"docusaurus-preset-openapi",
Expand Down
1 change: 1 addition & 0 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"@docusaurus/core": "^3.6.0",
"@docusaurus/faster": "^3.6.0",
"@svgr/webpack": "^5.5.0",
"clsx": "^1.2.1",
"docusaurus-preset-openapi": "^0.7.5",
Expand Down
13 changes: 9 additions & 4 deletions packages/docusaurus-theme-openapi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import path from "path";

import type { Plugin } from "@docusaurus/types";
import { ProvidePlugin } from "webpack";
import type { ConfigureWebpackUtils, Plugin } from "@docusaurus/types";
import type { Configuration as WebpackConfiguration } from "webpack";

export default function docusaurusThemeOpenAPI(): Plugin<void> {
return {
Expand All @@ -22,10 +22,15 @@ export default function docusaurusThemeOpenAPI(): Plugin<void> {
return path.resolve(__dirname, "..", "src", "theme");
},

configureWebpack() {
configureWebpack(
_config: WebpackConfiguration,
_isServer: boolean,
{ currentBundler }: ConfigureWebpackUtils
) {
const bundler = currentBundler.instance ?? require("webpack");
return {
plugins: [
new ProvidePlugin({
new bundler.ProvidePlugin({
Buffer: [require.resolve("buffer/"), "Buffer"],
process: require.resolve("process/browser"),
}),
Expand Down
Loading

0 comments on commit 194a6f2

Please sign in to comment.