Skip to content

Commit 7204366

Browse files
authored
Merge pull request #68 from easyops-cn/steve/fast
Update deps and enable Docusaurus faster
2 parents e112ff6 + e44d614 commit 7204366

File tree

5 files changed

+381
-24
lines changed

5 files changed

+381
-24
lines changed

babel.config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docusaurus.config.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
const path = require("path");
55
const { createHash } = require("crypto");
6-
const webpack = require("webpack");
76
const _ = require("lodash");
8-
const CopyPlugin = require("copy-webpack-plugin");
97
const MonacoEditorWebpackPlugin = require("monaco-editor-webpack-plugin");
108

119
const originalFilePath = path.resolve(
@@ -109,6 +107,10 @@ const config = {
109107
onBrokenLinks: "throw",
110108
onBrokenMarkdownLinks: "warn",
111109

110+
future: {
111+
experimental_faster: true,
112+
},
113+
112114
// Even if you don't use internalization, you can use this field to set useful
113115
// metadata like html lang. For example, if your site is Chinese, you may want
114116
// to replace "en" with "zh-Hans".
@@ -234,7 +236,7 @@ const config = {
234236
plugins: [
235237
() => ({
236238
name: "docusaurus-next-runtime",
237-
configureWebpack() {
239+
configureWebpack(config, isServer, { currentBundler }) {
238240
const previewDir = path.join(
239241
require.resolve("@next-core/preview/package.json"),
240242
"../dist"
@@ -252,18 +254,10 @@ const config = {
252254
test: /\.yaml/,
253255
type: "asset/source",
254256
},
255-
{
256-
// This file contains static initialization blocks which are not supported until Chrome 94
257-
test: /[\\/]node_modules[\\/]monaco-editor[\\/]esm[\\/]vs[\\/]language[\\/]typescript[\\/]tsMode\.js$/,
258-
loader: "babel-loader",
259-
options: {
260-
rootMode: "upward",
261-
},
262-
},
263257
],
264258
},
265259
plugins: [
266-
new CopyPlugin({
260+
new currentBundler.instance.CopyRspackPlugin({
267261
patterns: [
268262
{
269263
from: previewDir,
@@ -309,7 +303,7 @@ const config = {
309303
],
310304
filename: `workers/[name].[contenthash:8].worker.js`,
311305
}),
312-
new webpack.NormalModuleReplacementPlugin(
306+
new currentBundler.instance.NormalModuleReplacementPlugin(
313307
new RegExp(`^${_.escapeRegExp(originalFilePath)}$`),
314308
// Refactor without 'd' flag of RegExp
315309
path.resolve(__dirname, "src/replaces/findSectionHeaders.js")

jsconfig.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
2-
"extends": "./tsconfig.json",
2+
// This file is not used in compilation. It is here just for a nice editor experience.
3+
"extends": "@docusaurus/tsconfig",
34
"compilerOptions": {
4-
"moduleResolution": "Node"
5+
"baseUrl": ".",
6+
"target": "ESNext",
7+
"module": "ESNext",
8+
"moduleResolution": "Node",
9+
"strictNullChecks": false
510
},
6-
"include": ["**/*.js"]
11+
"include": ["**/*.js"],
12+
"exclude": ["node_modules", "build"]
713
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
"react-dom": "^19.0.0"
4040
},
4141
"devDependencies": {
42+
"@docusaurus/faster": "^3.7.0",
4243
"@docusaurus/module-type-aliases": "3.7.0",
4344
"@docusaurus/tsconfig": "3.7.0",
4445
"@docusaurus/types": "3.7.0",
4546
"@typescript-eslint/eslint-plugin": "^6.10.0",
4647
"@typescript-eslint/parser": "^6.10.0",
47-
"copy-webpack-plugin": "^11.0.0",
4848
"eslint": "^8.39.0",
4949
"eslint-config-prettier": "^8.8.0",
5050
"eslint-plugin-react": "^7.32.2",

0 commit comments

Comments
 (0)