FEMessage/el-data-table

启动时报错:[ERROR] Could not resolve "@babel/runtime/xxx"

zangbianxuegu opened this issue · 1 comments

Describe the bug

引入 el-data-table,启动时报错。

Screenshots

VITE v3.1.4 ready in 207 ms

➜ Local: http://127.0.0.1:5176/
➜ Network: use --host to expose
✘ [ERROR] Could not resolve "@babel/runtime/helpers/toConsumableArray"

node_modules/@femessage/el-form-renderer/dist/el-form-renderer.esm.js:1:31:
  1 │ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
    ╵                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/toConsumableArray" as external to exclude it from
the bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/regenerator"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:1:32:
  1 │ import _regeneratorRuntime from '@babel/runtime/regenerator';
    ╵                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/regenerator" as external to exclude it from the bundle,
which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/defineProperty"

node_modules/@femessage/el-form-renderer/dist/el-form-renderer.esm.js:2:28:
  2 │ import _defineProperty from '@babel/runtime/helpers/defineProperty';
    ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/defineProperty" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/asyncToGenerator"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:2:30:
  2 │ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
    ╵                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/asyncToGenerator" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/objectSpread"

node_modules/@femessage/el-form-renderer/dist/el-form-renderer.esm.js:3:26:
  3 │ import _objectSpread from '@babel/runtime/helpers/objectSpread';
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/objectSpread" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/toConsumableArray"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:3:31:
  3 │ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
    ╵                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/toConsumableArray" as external to exclude it from
the bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/objectSpread"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:4:26:
  4 │ import _objectSpread from '@babel/runtime/helpers/objectSpread';
    ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/objectSpread" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/slicedToArray"

node_modules/@femessage/el-form-renderer/dist/el-form-renderer.esm.js:7:27:
  7 │ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
    ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/slicedToArray" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/slicedToArray"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:9:27:
  9 │ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
    ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/slicedToArray" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/possibleConstructorReturn"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:10:39:
  10 │ import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
     ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/possibleConstructorReturn" as external to exclude it
from the bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/getPrototypeOf"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:11:28:
  11 │ import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
     ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/getPrototypeOf" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/inherits"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:12:22:
  12 │ import _inherits from '@babel/runtime/helpers/inherits';
     ╵                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/inherits" as external to exclude it from the bundle,
which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/extends"

node_modules/@femessage/el-form-renderer/dist/el-form-renderer.esm.js:14:21:
  14 │ import _extends from '@babel/runtime/helpers/extends';
     ╵                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/extends" as external to exclude it from the bundle,
which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/classCallCheck"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:13:28:
  13 │ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
     ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/classCallCheck" as external to exclude it from the
bundle, which will remove this error.

✘ [ERROR] Could not resolve "@babel/runtime/helpers/createClass"

node_modules/@femessage/el-data-table/dist/el-data-table.esm.js:14:25:
  14 │ import _createClass from '@babel/runtime/helpers/createClass';
     ╵                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can mark the path "@babel/runtime/helpers/createClass" as external to exclude it from the
bundle, which will remove this error.

To Reproduce

Steps to reproduce the behavior:

  1. Vite 创建项目,选择 Vue2
  2. main.js 中引入 el-data-table
  3. 启动项目
  4. See error

Expected behavior

正常启动项目

environment information

  "dependencies": {
    "vue": "^2.7.7"
  },
  "devDependencies": {
    "@femessage/el-data-table": "^1.23.2",
    "@femessage/el-form-renderer": "^1.24.0",
    "@vitejs/plugin-legacy": "^2.0.0",
    "@vitejs/plugin-vue2": "^1.1.2",
    "@vitejs/plugin-vue2-jsx": "^1.0.2",
    "axios": "^1.0.0",
    "element-ui": "^2.15.10",
    "terser": "^5.14.2",
    "vite": "^3.0.2"
  }

是因为你用vite?这个没测试过的哦,我们用的是 webpack