Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nextjs can't import minimal bundle #14864

Closed
hoangtrung99 opened this issue May 5, 2021 · 4 comments
Closed

Nextjs can't import minimal bundle #14864

hoangtrung99 opened this issue May 5, 2021 · 4 comments
Labels
bug en This issue is in English missing-demo The author should provide a demo. pending We are not sure about whether this is a bug/new feature. waiting-for: community

Comments

@hoangtrung99
Copy link

hoangtrung99 commented May 5, 2021

Version

5.1.1

Steps to reproduce

import * as echarts from 'echarts/core' got SyntaxError: Unexpected token 'export'

What is expected?

I hope to enter echart from core

What is actually happening?

But I got error: SyntaxError: Unexpected token 'export'
environment:

  • Nextjs 10.2.0
  • Typescript
  • No next config file

My tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": "./",
    "paths": {
      "@/*": ["src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}
@echarts-bot
Copy link

echarts-bot bot commented May 5, 2021

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that it contains a minimum reproducible demo and necessary images to illustrate. Otherwise, our committers will ask you to do so.

A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical question.

If you are interested in the project, you may also subscribe our mailing list.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added bug en This issue is in English pending We are not sure about whether this is a bug/new feature. waiting-for: community labels May 5, 2021
@pissang pissang added the missing-demo The author should provide a demo. label May 6, 2021
@echarts-bot
Copy link

echarts-bot bot commented May 6, 2021

@hoangtrung99 Please provide a minimum reproducible demo for the issue either with https://codepen.io/Ovilia/pen/dyYWXWM , https://www.makeapie.com/editor.html or https://codesandbox.io/s/mystifying-bash-2uthz.

A minimum reproducible demo should contain as little data and components as possible but can still illustrate your problem. This is the best way for us to reproduce it and solve the problem faster.

@hoangtrung99
Copy link
Author

Echarts-for-react fault
If I import together it will get an error

@kunKun-tx
Copy link

Next.js currently doesn't support import es module
related discussion:

  1. Support ES module format (ESM) in next.config.js vercel/next.js#9607
  2. Next server ESM support vercel/next.js#25423 (possible workarounds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug en This issue is in English missing-demo The author should provide a demo. pending We are not sure about whether this is a bug/new feature. waiting-for: community
Projects
None yet
Development

No branches or pull requests

3 participants