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

sample config file causes SyntaxError: Cannot use import statement outside a module #141

Open
namiwang opened this issue Apr 21, 2024 · 0 comments

Comments

@namiwang
Copy link

namiwang commented Apr 21, 2024

Environment

  • latest main branch 390925f8909d00b169fad81c4f0a3146e695d116
  • macos 14.4

Steps to Reproduce

  1. npm run build
  2. node lib/index.js --config=config.sample.js render

with config.sample.js exactly the same as in README

Actual Result

/Users/user/chartcuterie/config.sample.js:1
import world from 'echarts/map/json/world.json';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at ConfigService.<anonymous> (/Users/nami/workspace/trackhn/chartcuterie/lib/config.js:113:24)

Investigation

I tried to add "type": "module" in package.json and got another error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant