Vue - [ERROR] Could not resolve "../index"
hamzanouali opened this issue Β· comments
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch @formkit/auto-animate@1.0.0-pre-alpha.3
for the project I'm working on.
Project: Nuxt 3.8
Node version: 18.17.1
npm version: 9.67
Here is the diff that solved my problem:
diff --git a/node_modules/@formkit/auto-animate/vue/index.mjs b/node_modules/@formkit/auto-animate/vue/index.mjs
index 299222c..755ba97 100644
--- a/node_modules/@formkit/auto-animate/vue/index.mjs
+++ b/node_modules/@formkit/auto-animate/vue/index.mjs
@@ -1,4 +1,4 @@
-import { vAutoAnimate } from '../index';
+import { vAutoAnimate } from '../index.mjs';
const autoAnimatePlugin = {
install(app) {
This issue body was partially generated by patch-package.
Why the old version of AutoAnimate?
I can attest, I also ran into this issue. Downgaded from 1.0.0-pre-alpha.3
to 0.8.1
, and it works as usual again. @justin-schroeder May I ask why you consider 1.0.0-pre-alpha.3
to be an older version than 0.8.1
?
In 0.8.1
, the Vue index file still correctly imports the parent index:
import { ref, onMounted, watchEffect } from 'vue';
import autoAnimate, { vAutoAnimate as vAutoAnimate$1 } from '../index.mjs';
Seems like Vite can't resolve it if it's just ../index
? I'm not sure what's going on here.
EDIT:
Our dependabot automatically """bumped""" auto-animate from beta to pre-alpha. Dunno what it was smoking:
I noticed Vite seems to be having issues with .mjs
files - not only can it not automatically import .mjs
files when you import without an extension, but imports from within that file also seem to behave differently. I'm struggling to figure out when exactly this broke, or if it's always been like this.
May I ask why you consider
1.0.0-pre-alpha.3
to be an older version than0.8.1
?
We stopped doing "preid" suffix releases a while back because they caused confusion for package managers. Instead we are using standard ol semver in the 0.x
ranges. You can see the historical releases here:
https://www.npmjs.com/package/@formkit/auto-animate?activeTab=versions
Which version do you recommend I use? beta.6, or 0.8.x?
0.8.x
Alright, got it