import { webpackBundler } from "@vuepress/bundler-webpack"; import { defaultTheme } from "@vuepress/theme-default"; import { defineUserConfig } from "vuepress"; import theme from "./vuepress.theme"; export default defineUserConfig({ bundler: webpackBundler({ // 自定义 webpack 配置 configureWebpack: (config, isServer, isBuild) => { return { module: { // 解决 @maxgraph/core 的问题, 避免出现以下错误: // ERROR in ./node_modules/.pnpm/@maxgraph+core@0.13.0/node_modules/@maxgraph/core/dist/index.js 175:0-24 // Module not found: Error: Can't resolve './types' in '/Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/io.sc.platform.core.frontend/node_modules/.pnpm/@maxgraph+core@0.13.0/node_modules/@maxgraph/core/dist' // Did you mean 'types.js'? // BREAKING CHANGE: The request './types' failed to resolve only because it was resolved as fully specified // (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"'). // The extension in the request is mandatory for it to be fully specified. rules: [ { test: /\.js$/, include: /[\/\\]@maxgraph[\/\\]core/, resolve: { fullySpecified: false, }, }, ], }, // 解决 @maxgraph/core 的问题, 避免出现以下错误: // ERROR in ./node_modules/.pnpm/platform-core@8.1.372_rglpzkkg4umhmrchez7aoyu2m4/node_modules/platform-core/dist/platform-core.js 3:428-453 // Module not found: Error: Package path . is not exported from package /Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/io.sc.platform.core.frontend.doc/node_modules/.pnpm/platform-core@8.1.372_rglpzkkg4umhmrchez7aoyu2m4/node_modules/@maxgraph/core (see exports field in /Users/wangshaoping/wspsc/workspace/wangshaoping/v8/platform/io.sc.platform.core.frontend.doc/node_modules/.pnpm/platform-core@8.1.372_rglpzkkg4umhmrchez7aoyu2m4/node_modules/@maxgraph/core/package.json) // 同时解决 quasar 默认加载 /dist/quasar.server.prod.cjs 文件出现错误 resolve: { // 以下配置使得在 node_modules 目录下的模块加载入口文件采用模块 package.json 的 exports 部分采用 import 配置加载优先 modules: ["node_modules"], conditionNames: ["import"], }, }; }, }), // 网站 Base URL base: "/io.sc.platform.developer.doc/", // 网站导航栏标题 title: theme.navigatorTitle, // 默认主题 theme: defaultTheme(theme), // 打包目录 dest: "dist/public/site/", // 缓存目录 cache: "./.vuepress/.cache", // 临时目录 temp: "./.vuepress/.temp", // 服务端口 port: 3000, // public 目录 public: "./public", });