You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL test/echarts.test.ts [ test/echarts.test.ts ]
SyntaxError: Cannot use import statement outside a module
❯ Object.compileFunction https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:341311
❯ wrapSafe https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:218270
❯ Module._compile https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:218638
❯ Module._extensions..js https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:219666
❯ Module.load https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:217692
❯ Module._load https:/vitest-dev-vitest-kcuvdv.w.staticblitz.com/blitz.ad37e903755d89e0f5d9999e69be73a0c6cb6bcc.js:6:215263
Module /home/projects/vitest-dev-vitest-kcuvdv/node_modules/echarts/lib/core/echarts.js:26 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "echarts" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
As a temporary workaround you can try to inline the package by updating your config:
// vitest.config.js
export default {
test: {
deps: {
inline: [
"echarts"
]
}
}
}
Expected Behavior
ECharts should be imported correctly as an ES Module by vitest.
ECharts may need to support dual packaging mentioned in this guide.
Environment
- OS: Windows 11
- Browser: Chrome
- Framework: Vue@2 + Vite
Reproduction with `vue-echarts` here: [stackblitz.com/edit/vitest-dev-vitest-fhmvl9](stackblitz.com/edit/vitest-dev-vitest-fhmvl9)
Any additional comments?
This issue has been mentioned before in #16599 but is closed now.
Version
5.3.2
Link to Minimal Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-kcuvdv
Steps to Reproduce
Current Behavior
Vitest throw the following error:
Expected Behavior
ECharts should be imported correctly as an ES Module by vitest.
ECharts may need to support dual packaging mentioned in this guide.
Environment
Any additional comments?
This issue has been mentioned before in #16599 but is closed now.
See also the comments of
vitest
member:ecomfe/vue-echarts#601 (comment)
vitest-dev/vitest#1452 (comment)
The text was updated successfully, but these errors were encountered: