From 4eaaa612ece42f102dd065de53d2d5a0040b7e83 Mon Sep 17 00:00:00 2001 From: goodroot <9484709+goodroot@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:52:27 -0800 Subject: [PATCH] try webpack changes for Rspack --- docusaurus.config.js | 3 +-- plugins/manifest/index.js | 5 ++--- plugins/optimize/index.js | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 0982152f..75498024 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -89,13 +89,12 @@ const config = { function (context, options) { return { name: 'development-redirects', - configureWebpack(config, isServer, utils) { + configureWebpack(config, isServer, { currentBundler }) { if (process.env.NODE_ENV === 'development') { return { devServer: { onBeforeSetupMiddleware: function (devServer) { devServer.app.get('*', function (req, res, next) { - // If path doesn't start with /docs, redirect to Next.js if (!req.path.startsWith('/docs/')) { return res.redirect(`http://localhost:3000${req.path}`) } diff --git a/plugins/manifest/index.js b/plugins/manifest/index.js index 936c6b58..0fac6e4c 100644 --- a/plugins/manifest/index.js +++ b/plugins/manifest/index.js @@ -1,8 +1,7 @@ -const { WebpackManifestPlugin } = require("webpack-manifest-plugin") - module.exports = () => ({ name: "manifest", - configureWebpack: (_, isServer) => { + configureWebpack: (config, isServer, { currentBundler }) => { + const { WebpackManifestPlugin } = currentBundler.instance.require("webpack-manifest-plugin") return { plugins: isServer ? [] diff --git a/plugins/optimize/index.js b/plugins/optimize/index.js index aca8c3f6..0c70cd9a 100644 --- a/plugins/optimize/index.js +++ b/plugins/optimize/index.js @@ -1,13 +1,12 @@ module.exports = () => ({ name: "optimize", - configureWebpack: (_, isServer) => { + configureWebpack: (config, isServer, { currentBundler }) => { return { optimization: { runtimeChunk: false, splitChunks: isServer ? false : { - // name: true, // Does not exist anymore, see https://webpack.js.org/blog/2020-10-10-webpack-5-release/ cacheGroups: { common: { name: "common",