chartcuterie icon indicating copy to clipboard operation
chartcuterie copied to clipboard

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

Open namiwang opened this issue 1 year ago • 0 comments

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

namiwang avatar Apr 21 '24 06:04 namiwang