kingyue737 opened a new issue, #17189:
URL: https://github.com/apache/echarts/issues/17189

   ### Version
   
   5.3.2
   
   ### Link to Minimal Reproduction
   
   https://stackblitz.com/edit/vitest-dev-vitest-kcuvdv
   
   ### Steps to Reproduce
   
   1. Open the link
   2. Wait for the test to end
   
   ### Current Behavior
   
   Vitest throw the following error:
   
   ```
   ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ 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](https://github.com/sheremet-va/dual-packaging).
   
   
   
   ### Environment
   
   ```markdown
   - 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.
   
   See also the comments of `vitest` member:
   https://github.com/ecomfe/vue-echarts/issues/601#issuecomment-1150797371
   https://github.com/vitest-dev/vitest/issues/1452#issuecomment-1150750725


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to