Skip to content

[Bug] 在vite+vue3环境下构建失败 #505

Closed
@a1067111756

Description

@a1067111756

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem or a mini showcase.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • @antv/g2plot Version [e.g. v2.3.12]
  • @opd/g2plot-vue Version [e.g. v3.0.0]
  • vue Version [e.g. v3.0.0]

Additional context
非常高兴能有这个库,我想在我的项目里面使用g2plot,但是并不想自己动手在上层封装一个使用层,这个库刚好解决了这个问题。但是我发现在vite + vue3的环境中(现在很多开发者已经将工程的构建脚手架转移到vite),这个库的构建有一些问题,希望能帮忙查看一下此问题,并创建一个示例demo。

环境:

 "@antv/g2plot": "^2.3.37",
 "@opd/g2plot-vue": "^3.6.0",
 "vue": "^3.2.20",
 "vite": "^2.6.7",

构建报错:

[vite] error while updating dependencies:
  Error: Build failed with 3 errors:
  node_modules/@opd/g2plot-vue/es/components/base.js:1:26: error: Could not resolve "@babel/runtime/helpers/esm/objectSpread2" (mark it as external to exclude it from the bundle)
  node_modules/@opd/g2plot-vue/es/components/base.js:2:37: error: Could not resolve "@babel/runtime/helpers/esm/objectWithoutProperties" (mark it as external to exclude it from the bundle)
  node_modules/@opd/g2plot-vue/es/utils.js:1:26: error: Could not resolve "@babel/runtime/helpers/esm/objectSpread2" (mark it as external to exclude it from the bundle)
      at failureErrorWithLog (E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:1493:15)
      at E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:1151:28
      at runOnEndCallbacks (E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:941:63)
      at buildResponseToResult (E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:1149:7)
      at E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:1258:14
      at E:\水院项目工作空间\smart-water\smart-water-chishui\node_modules\esbuild\lib\main.js:629:9

问题猜测:
根据报错我猜测是babel配置的原因,但没有去深入追查。据文档指南,只是引入了@opd/g2plot-vue配置,并未要求配置babel

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions