I’m reaching out for help with an issue I’m experiencing with the vue-cal library during deployment of my project.
When trying to deploy, I’m receiving these errors:
🔸 ERROR Failed to compile with 9 errors
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/vuecal.css is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
and similar errors for translation files (./dist/i18n/en.es.js, ./dist/i18n/fr.es.js, etc.)
Module not found: Error: Package path ./dist/vuecal.css is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/en.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/fr.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/es.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/de.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/nl.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/it.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/pt-br.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
error in ./src/components/elements/element-4ce97e36-71b1-48d5-b89d-ef045c0e939e/src/wwElement.vue?vue&type=script&lang=js
Module not found: Error: Package path ./dist/i18n/ar.es.js is not exported from package /tmp/front/node_modules/vue-cal (see exports field in /tmp/front/node_modules/vue-cal/package.json)
Importantly, everything works fine in the editor and on localhost - there are no errors at all. The issues only appear during deployment.
I’m using vue-cal version 5.0.1-rc.8, which has a different export structure than previous versions.
I’ve tried uninstalling and reinstalling the vue-cal package, but this hasn’t resolved the issue.
Can you show us how you’re importing the things that don’t seem to have a proper path? This import for example is also from an npm library and it works just fine for me.
then i have compiled with problems in editor: Module not found: Error: Package path ./dist/i18n/en.json is not exported from package /Users/admin/vue-cal-custom-v1/node_modules/vue-cal (see exports field in /Users/admin/vue-cal-custom-v1/node_modules/vue-cal/package.json)
if i try: import "vue-cal/dist/i18n/";
then: Module not found: Error: Resolving to directories is not possible with the exports field (request was ./dist/i18n/)
if i try: import "vue-cal/i18n/pl.json";
then in editor is fine, but with deploy still problem
import { VueCal } from "vue-cal";
import "vue-cal/style";
import { useLocale, addDatePrototypes } from 'vue-cal'
import Pl from 'vue-cal/i18n/pl.json'
import Fr from "vue-cal/i18n/fr.json";
import Es from "vue-cal/i18n/es.json";
import De from "vue-cal/i18n/de.json";
import Nl from "vue-cal/i18n/nl.json";
import It from "vue-cal/i18n/it.json";
import Ar from "vue-cal/i18n/ar.json";
useLocale(Pl)
addDatePrototypes()
you are probably still using v4.
check the vue-cal version in the dependencies of the package.json of your element.
try installing v5 with npm i vue-cal@next
import { VueCal } from "vue-cal";
import "vue-cal/style";
import "vue-cal/i18n/pl";
in your local repo try these imports and test a local build with npm run build -- name=test type=element
if it builds without errors you can then push it to github, wait for weweb to build the component, set the last version in the dashboard and then rebuild your app
EDIT!
forget about anything I said above. you can not use vue-cal v5 at the moment.
weweb uses vue-cal v4.10.0 and that’s the only version you can use
when building your app your dependencies are merged with the one used by weweb. from the docs:
You can add other dependencies if you need to. Be aware that all package.json will be merged in the final web-app and, if two components need the same dependencies, only the more recent one will be installed. This can lead to conflicts.
so your options are:
use vue-cal v4.10.0
try removing any weweb elements using vue-cal as dependency in your app to see if you can avoid the version conflict
bundle vue-cal in another file in your project and import it from there. I would avoid this option since you will have the same lib twice in your final app.