Skip to content

Import fails with Vue3 + Vite5 + VitestΒ #124

Open
@ajuvonen

Description

@ajuvonen

Description

Apologies for not providing a complete repro, since I'm only currently evaluating the library. But I tried it out mimicking some of the behavior from your Vue example. This, however, makes all the Vitest unit tests in the project to fail with the following message.

TypeError: Cannot read properties of undefined (reading 'defineComponent')
 ❯ node_modules/@fireworks-js/vue/dist/index.umd.js:8:318

 ❯ node_modules/@fireworks-js/vue/dist/index.umd.js:8:235
 ❯ node_modules/@fireworks-js/vue/dist/index.umd.js:8:273

I can get around this by mocking the import of @fireworks-js/vue in my test setups, but is it possible to avoid this?

My code (partial):

import {Fireworks, type FireworksOptions} from '@fireworks-js/vue';

const fireworksOptions: Partial<FireworksOptions> = {
  acceleration: 1,
};

<Fireworks
  :autostart="fireworks"
  :options="fireworksOptions"
  class="modal-dialog__backdrop"
  aria-hidden="true"
/>

My deps:

"@fireworks-js/vue": "^2.10.8",
"vue": "3.5.12",
"vite": "^5.4.9",
"vitest": "^2.1.3",

Which package are you using?

@fireworks-js/vue

fireworks-js version

2.10.8

Browser

Firefox 131

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions