Skip to content

[BUG] 使用@berryv/g2-react绘制图表时候,刷新报错 #93

@panxiaoxiao0823

Description

@panxiaoxiao0823

`
import { Chart } from '@berryv/g2-react';

{/* 图表测试 */}
<Chart
options={{
type: 'interval',
width: 640,
height: 480,
data: [
{ genre: 'Sports', sold: 275 },
{ genre: 'Strategy', sold: 115 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
],
encode: { x: 'genre', y: 'sold' },
}}
/>`

刷新就会报错
Server Error
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/my/DB-GPT-Web-main/node_modules/@berryv/g2-react/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

这是什么原因?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions