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

请问下 使用axios需要什么配置嘛 打包会报错 fetch 可以正常dumi build #1924

Closed
eternallycyf opened this issue Oct 4, 2023 · 0 comments
Labels
question Further information is requested

Comments

@eternallycyf
Copy link
Contributor

eternallycyf commented Oct 4, 2023

使用了mock

// .dumirc.ts
mock: {
    include: ['mock/**/*.{ts}'],
  },

// mock/xxx.ts
'POST /fetchUserInfo': {
    code: 200,
    msg: '请求成功',
    success: true,
    data: mockjs.mock({
      userId: 2313123
      usename: '张三',
    }),
  },

fetch 可以正常dumi build。使用了axios umi-request 等 打包 就会报错
本地dumi dev是正常的

...
"ERROR_OVERLAY":"none","WEBPACK_FS_CACHE_DEBUG":"1 dumi dev"}.DEBUG = namespaces;
...
SyntaxError: Unexpected token ':'
    at internalCompileFunction (node:internal/vm:74:18)
    at wrapSafe (node:internal/modules/cjs/loader:1141:20)
    at Module._compile (node:internal/modules/cjs/loader:1182:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at getPreRenderedHTML  (/xxx/node_modules/.pnpm/@umijs+preset-umi@4.0.83_@types+node@16.18.57_@types+react@18.2.24_postcss@8.4.31_sass@1.68.0_4j2cp25elmtewspd7u5y3chl5m/node_modules/@umijs/preset-umi/dist/features/exportStatic/exportStatic.js:71:35)
    at Hook.fn (/xxx/node_modules/.pnpm/@umijs+preset-umi@4.0.83_@types+node@16.18.57_@types+react@18.2.24_postcss@8.4.31_sass@1.68.0_4j2cp25elmtewspd7u5y3chl5m/node_modules/@umijs/preset-umi/dist/features/exportStatic/exportStatic.js:181:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async xxx/node_modules/.pnpm/@umijs+core@4.0.83/node_modules/@umijs/core/dist/service/service.js:136:27
@eternallycyf eternallycyf added the question Further information is requested label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant