标签: umijs

“HTTPS”未被识别为内部或外部命令

我想在我的 Windows 中运行一个 React 项目(作为我的 Mac 的虚拟机)。

在命令提示符下,运行后yarn安装依赖项。我做到了yarn start。它给了我'HTTPS' is not recognized as an internal or external command错误。

> yarn start
yarn run v1.13.0
$ HTTPS=true CERT=cert/localhost.crt KEY=cert/localhost.key umi dev
'HTTPS' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这一问题?

编辑1

我将节点升级到v12.16.1yarn1.13.0,npm 到6.13.4),并执行了yarn …

command-prompt npm windows-10 yarnpkg umijs

15
推荐指数
2
解决办法
3万
查看次数

AADSTS9002326:仅允许“单页应用程序”进行跨域令牌兑换

我正在尝试发送跨源请求以获取我的 React spa 应用程序本地主机上的访问令牌。我收到第一个“Access-Control-Allow-Origin”错误,为了解决它,我定义了 webpack 的代理。

当我运行下面的代码块时,我收到 400 个错误请求错误。

Proxy code
'/payment': {
  target: 'https://apitest.domain.com',
  changeOrigin: true,
  secure: false,
  pathRewrite: { '^/payment': '' },
}
-------------------
  async getPaymentAccessToken() {
    const msg = await request<PaymentAccessTokenResponse>(`/payment/accesstoken/get`, {
      method: 'POST',
      prefix: undefined,
      credentials: 'include',
      headers: {
        client_id: this.client.client_id,
        client_secret: this.client.client_secret,
        'Ocp-Apim-Subscription-Key': this.client['payment-Subscription-Key'],
        'Merchant-Serial-Number': this.client['Merchant-Serial-Number']!,
      },
    });

    return msg;
  }
Run Code Online (Sandbox Code Playgroud)

{“error”:“invalid_request”,“error_description”:“AADSTS9002326:仅允许“单页应用程序”客户端类型进行跨域令牌兑换。\r\n跟踪 ID:0c7f2993-b612-434d-9cee- 244e88f51600\r\n相关 ID: 45d80262-c77f-487b-a95b-4566c736e1bc\r\n时间戳: 2022-06-07 19:14:30Z","error_codes":[9002326],"timestamp":"2022-06- 07 19:14:30Z","trace_id":"0c7f2993-b612-434d-9cee-244e88f51600","correlation_id":"45d80262-c77f-487b-a95b-4566c736e1bc","error_uri":"https://login .windows.net/error?code=9002326"}

javascript reactjs webpack axios umijs

9
推荐指数
1
解决办法
2万
查看次数

“代理”在 IE 中未定义

我已经通过 React+Node+ Umi构建了一个 Excel 插件。我们已经实施了我们的身份验证系统。验证在 Chrome 和 Safari 中有效,我刚刚发现它在 IE11 中无法正常工作;F12表明'Proxy' is undefined.

尽管它是一个 Excel 加载项,但我们可以仅在浏览器中重现该错误(以及相同的错误消息)。在 IE 11 中打开链接https://jsaddin.10studio.tech/welcome/?next=formulaEditor,使用 ID3094557608@qq.com和密码登录:123456。我们可以在 F12 中看到错误消息。

在此处输入图片说明

有人知道吗

  1. 如何解决这个问题?
  2. 我怎么知道我的代码的哪个库/部分使用了这个Proxy?我可以用替代品代替它。

编辑1:.umirc.ts

treeShaking: true,
targets: {
  ie: 9,
  safari: 9,
},
Run Code Online (Sandbox Code Playgroud)

package.json

"umi": "^2.7.0",
"umi-plugin-react": "^1.8.0",
"umi-types": "^0.2.0"
Run Code Online (Sandbox Code Playgroud)

编辑2:

我试过yarn add proxy-polyfill,然后yarn start。奇怪的是,它在 localhost 中引发了一个错误,Invalid character并且'umi' is undefined

在此处输入图片说明

cross-browser node.js express reactjs umijs

6
推荐指数
1
解决办法
3400
查看次数

结合umijs 生成react-pdf 非常慢

我在一个新的 umi 项目中包含了react-pdf

  • PDF 生成 150 个文本组件在没有 umi 的情况下花费了大约 311.44 毫秒
  • 使用 umi:7179.40 毫秒

在 umi 项目中,每个元素都需要大约 10 倍!

我试过的代码示例

import React from "react";
import "./styles.css";
import { Document, Page, pdf, Text, View } from "@react-pdf/renderer";

export default function App() {
  const pdfClickHandler = async () => {
    console.time("PDF generation took:");
    await pdf(
      <Document>
        <Page>
          <View>
            {Array.from(Array(150).keys()).map((key) => (
              <Text key={key}>text-element</Text>
            ))}
          </View>
        </Page>
      </Document>
    ).toBlob();
    console.timeEnd("PDF generation took:");
  };

  return (
    <div className="App">
      <button …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs react-pdf ant-design-pro umijs

6
推荐指数
1
解决办法
1284
查看次数

如何禁用 Antd 表中的行

所以我做了一个项目,使用 react js 和 umi js 和 antd 作为附加依赖项,

当我接到禁用 antd 表中每一行的任务时遇到了问题,

我试图阅读文档 antd 但一无所获,

你有可能做到吗?或者有另一种可能的方法来做到这一点

感谢您的帮助

这是我的代码:

/* eslint-disable */
import React, { useState, useEffect, useRef } from 'react';
import { Modal, Button, Select, message, Radio, Table, Alert } from 'antd';
import _       from 'lodash';
import axios   from 'axios';
import cookies from 'js-cookie';
import {_getCurrentBusiness} from '../../../utils/utils_business';
import {formatMessage }     from 'umi-plugin-locale';

function DeleteConfirm (props) {

    const user_auth           = cookies.getJSON('ckmsbp');
    const business            = _getCurrentBusiness();
    const [radio, setRadio]   = useState('all'); …
Run Code Online (Sandbox Code Playgroud)

reactjs antd umijs

4
推荐指数
1
解决办法
4826
查看次数