Skip to content

error throw while import echart on demand via babel  #14965

@ranglang

Description

@ranglang

Version

5.1.1

Steps to reproduce

  1. const echarts = require('echarts/lib/echarts')
  2. babel-node ./src

What is expected?

no error found

What is actually happening?

/Users/rang/WebstormProjects/react-webpack-5-tailwind-2/node_modules/echarts/charts.js:27
export * from './lib/export/charts';
^^^^^^

SyntaxError: Unexpected token 'export'
at compileFunction ()
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Module._compile (/Users/wisers/WebstormProjects/react-webpack-5-tailwind-2/node_modules/pirates/lib/index.js:99:24)
at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Object.newLoader [as .js] (/Users/wisers/WebstormProjects/react-webpack-5-tailwind-2/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


demo https://github.com/ranglang/bug-chart-babel.git

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in Englishnot-a-bug

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions