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

最新版报错 #4

Open
AnyFork opened this issue Jul 18, 2023 · 3 comments
Open

最新版报错 #4

AnyFork opened this issue Jul 18, 2023 · 3 comments

Comments

@AnyFork
Copy link

AnyFork commented Jul 18, 2023

配置如下:

 pageRoute({
        pageDir: "src/views",
        pageGlobs: ["**/index.{vue,tsx,jsx}", "!**/components/**"],
        routeDts: "src/types/page-route.d.ts",
        routeModuleDir: "src/router/module",
        routeModuleExt: "ts",
        routeModuleType: "AuthRoute.Route",
        /**
         * @example _builtin_login => login
         */
        routeNameTansformer: (name) =>
          name.replace(/^_([a-zA-Z]|[0-9]|$)+_*/, ""),
        /**
         * 路由懒加载
         * @param name 路由名称
         * @example
         * - 直接导入
         * ```ts
         * import Home from './views/home/index.vue';
         * ```
         * - 懒加载导入
         * ```ts
         * const Home = import('./views/home/index.vue');
         * ```
         */
        lazyImport: (_name) => true, // 默认
        /**
         * 是否生成路由模块
         * @param name 未转换过的路由名称(没有调用函数routeNameTansformer)
         * @returns 是否生成路由模块的代码
         */
        onRouteModuleGenerate: (name) => !name.includes("_builtin"),
      })
    ],

启动报错

PS G:\anyfork-common-admin\vue-anyfork-admin> pnpm dev

> [email protected] dev G:\anyfork-common-admin\vue-anyfork-admin
> vite

failed to load config from G:\anyfork-common-admin\vue-anyfork-admin\vite.config.ts
error when starting dev server:
file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/registry.npmmirror.com+@[email protected]/node_modules/@soybeanjs/vite-plugin-vue-page-route/dist/index.mjs:49
import { isMatch } from "micromatch";
         ^^^^^^^
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'micromatch';
const { isMatch } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:533:24)
    at async loadConfigFromBundledFile (file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-abb4f102.js:66128:21)
    at async loadConfigFromFile (file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-abb4f102.js:65979:28)
    at async resolveConfig (file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-abb4f102.js:65575:28)
    at async _createServer (file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/chunks/dep-abb4f102.js:64846:20)
    at async CAC.<anonymous> (file:///G:/anyfork-common-admin/vue-anyfork-admin/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/cli.js:743:24)
 ELIFECYCLE  Command failed with exit code 1.
@honghuangdc
Copy link
Member

ES module暂时有问题

@honghuangdc
Copy link
Member

请先用 commonjs模式运行

@honghuangdc
Copy link
Member

路由插件 elegant-router 会代替该插件,敬请期待

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants