According to Vitest, it seems like the current export of the ESM build is not quite correct.
When using Awilix with Vitest, I get informed of the following:
Module /Users/.../node_modules/awilix/lib/awilix.module.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "awilix" 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: [
"awilix"
]
}
}
}
The proposed workaround works fine, but it would be nice if it wasn't needed.
I also tested native ESM loading in Node.js, which worked fine with the current setup. So I'm not sure if the package really is wrong or if it's a Vitest/Vite issue.
I'm happy to contribute a PR to make the adjustment if you like.
According to Vitest, it seems like the current export of the ESM build is not quite correct.
When using Awilix with Vitest, I get informed of the following:
The proposed workaround works fine, but it would be nice if it wasn't needed.
I also tested native ESM loading in Node.js, which worked fine with the current setup. So I'm not sure if the package really is wrong or if it's a Vitest/Vite issue.
I'm happy to contribute a PR to make the adjustment if you like.