Closed cexbrayat closed 2 years ago
It should be a matter of configuring unbuild to output cjs. Contribution welcome!
Don't you think this https://github.com/posva/vue-router-mock/commit/b7fd685c03a72f767b50fa4c5ed4e45f0385f5a3#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R5 is the source of the regression?
No, I did that because there is no cjs file generated at the moment
I am working on a PR to build both .mjs
and .cjs
files. ๐
@pgarciaegido I actually just found the fix and pushed it ๐
Amazing @posva !
Just one little comment, do you think it makes sense to use the exports
field to expose both files?
"exports": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
Thanks a lot! :smile:
Totally! Published a new verison
Reproduction
A CLI app using Jest and
createRouterMock
in a unit test will throw when upgrading to v1.0.4 with:This is because the main file switched to the
mjs
format, which is great for Vite but not ideal for Jest.Expected behavior
Jest tests should still work