vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.22k stars 2.13k forks source link

Error after importing Calendar from version 4 #4306

Closed jackshinshin closed 4 weeks ago

jackshinshin commented 4 weeks ago

Describe the bug

I'm using version 4.1.1. After seeing picked date unscathed by setting dateFormat="yy-mm-dd" to DatePicker component, I imported the Calendar component without realizing it was from versoin 3. After hitting save file, the following error keeps popping up.

[vite] page reload src/main.js [vite] Pre-transform error: Missing "./" specifier in "primevue" package [vite] Internal server error: Missing "./" specifier in "primevue" package

Reproduction

  1. Add the Calendar component in the main.js file
    
    import { createApp } from 'vue'
    import App from './App.vue'
    import router from './router'
    import './assets/main.css'

import PrimeVue from 'primevue/config' import InputText from 'primevue/inputtext' import Button from 'primevue/button' import Lara from '@primevue/themes/lara' import DatePicker from 'primevue/datepicker' import Tabs from 'primevue/tabs' import TabList from 'primevue/tablist' import TabPanels from 'primevue/tabpanels' import DataTable from 'primevue/datatable' import Column from 'primevue/column' import ToastService from 'primevue/' import Calendar from 'primevue/calendar' // import 'primeicons/primeicons.css';

const app = createApp(App)

app.use(router)

app.use(PrimeVue, { theme: { preset: Lara, }, }) app.use(ToastService) app.component('InputText', InputText) app.component('Button', Button) app.component('Tabs', Tabs) app.component('TabList', TabList) app.component('TabPanels', TabPanels) app.component('DataTable', DataTable) app.component('Column', Column) app.component('DatePicker', DatePicker)

app.component('Calendar', Calendar)

app.mount('#app')

2. Hit Ctrl+s to save file
3. The vite dev server hot updates

### Expected behavior

The dev server should run as always. I tried restarting the dev server, reinstalling primevue module, none of which gets me luck.

### System Info

```Text
System:
    OS: Windows 11 10.0.22631
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13500
    Memory: 24.36 GB / 47.75 GB
  Binaries:
    Node: 20.10.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.2.3 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.1 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

Additional context

I checked everywhere in the project, and everything about Calendar is cleared thoroughly.

Validations

brc-dd commented 4 weeks ago

Your ToastService import is wrong. It should be:

import ToastService from 'primevue/toastservice'