alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.98k stars 988 forks source link

【Bug】Form-render 最近版本构建异常 #1425

Closed LiangNex closed 10 months ago

LiangNex commented 11 months ago

1.依赖仓库的版本(Dependencies versions)

2.问题描述(Bug description): 昨天更新的form-render2.3.0版本,sanitize-html无法解析,构建异常

> build
> cross-env UMI_ENV=prod umi build

✖ Webpack
  Compiled with some errors in 1.62m

Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
 ERROR  Failed to compile with 1 errors                                                                                               11:24:08 AM

 error  in ./node_modules/_htmlparser2@8.0.2@htmlparser2/lib/esm/index.js

Module parse failed: Unexpected token (48:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|  * They should probably be removed eventually.
|  */
> export * as ElementType from "domelementtype";
| import { getFeed } from "domutils";
| export { getFeed } from "domutils";

 @ ./node_modules/_sanitize-html@2.11.0@sanitize-html/index.js 1:19-41
 @ ./node_modules/_form-render@2.3.0@form-render/es/widgets/fields/html/index.js
 @ ./node_modules/_form-render@2.3.0@form-render/es/derivative/SlimRender/index.js
 @ ./node_modules/_form-render@2.3.0@form-render/es/index.js
 @ ./src/pages/monitor/orderInfoIntegration.jsx
 @ ./src/.umi-production/core/routes.ts
 @ ./src/.umi-production/umi.ts
 @ multi ./src/.umi-production/umi.ts

Child

    ERROR in ./node_modules/_htmlparser2@8.0.2@htmlparser2/lib/esm/index.js 48:9
    Module parse failed: Unexpected token (48:9)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    |  * They should probably be removed eventually.
    |  */
    > export * as ElementType from "domelementtype";
    | import { getFeed } from "domutils";
    | export { getFeed } from "domutils";
     @ ./node_modules/_sanitize-html@2.11.0@sanitize-html/index.js 1:19-41
     @ ./node_modules/_form-render@2.3.0@form-render/es/widgets/fields/html/index.js
     @ ./node_modules/_form-render@2.3.0@form-render/es/derivative/SlimRender/index.js
     @ ./node_modules/_form-render@2.3.0@form-render/es/index.js
     @ ./src/pages/monitor/orderInfoIntegration.jsx
     @ ./src/.umi-production/core/routes.ts
     @ ./src/.umi-production/umi.ts
     @ multi ./src/.umi-production/umi.ts
null
 info  如果你需要进交流群,请访问 https://fb.umijs.org
build failed

3.出现问题的 schema demo(Reproduction schema demo)

const schema = {
    type: 'object',
    properties: {
        renderId: {
            title: 'renderId',
            type: 'number',
            maxWidth: '340px',
            widget: 'input',
        },
        orderId: {
            title: 'orderId',
            type: 'number',
            widget: 'input',
        },
        eagleEyeId: {
            title: 'eagleEyeId',
            type: 'string',
            widget: 'input',
        },
        createTime: {
            title: '下单时间',
            type: 'range',
            format: 'date',
            props: {
                placeholder: ['开始时间', '结束时间'],
            },
            maxWidth: '340px',
            widget: 'dateRange',
        },
    },
    displayType: 'row',
    column: 4,
    maxWidth: '340px',
};

4.最小复现 demo(Reproduction demo): 晚点提供吧, 先锁依赖到上个版本解决了

LiangNex commented 11 months ago

应该是这个PR #1418 导致的,可能我们的工程需要改下webpack配置来兼容,但属于一个breakChange了

lhbxs commented 10 months ago

https://github.com/actions-cool/issues-helper/commit/49a9184d18c4b30588f5cc62a035634f4b7b58bc#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

lhbxs commented 10 months ago

试试这个