Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.0.0-beta3: ../primevue/themes/index.d.ts' is not a module when writing and building the app. #5749

Open
44m0n opened this issue May 16, 2024 · 5 comments
Assignees
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@44m0n
Copy link

44m0n commented May 16, 2024

Describe the bug

When using definePreset we get this warning in vscode:
File '/ProjectPath.././node_modules/primevue/themes/index.d.ts' is not a module.ts(2306). If we ignore the warning this works in development environment. If we're trying to build the app we get this error:
src/main.ts(8,30): error TS2306: File '/opt/buildhome/repo/node_modules/primevue/themes/index.d.ts' is not a module.

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import PrimeVue from 'primevue/config'
import Aura from 'primevue/themes/aura'
import { definePreset } from 'primevue/themes' //here is the issue
import Ripple from 'primevue/ripple'
import StyleClass from 'primevue/styleclass'

const app = createApp(App)

const CustomPreset = definePreset(Aura, {
  semantic: {
    primary: {
      50: '{rose.50}'
    }
  }
})

app.use(router)
app.use(PrimeVue, {
  ripple: true,
  theme: {
    preset: CustomPreset,
    options: {
      prefix: 'p',
      darkModeSelector: 'system',
      cssLayer: false
    }
  }
})

app.directive('ripple', Ripple).directive('styleclass', StyleClass)

app.mount('#app')

I didn't find any workaround yet. I can't create a reproducer right now, I will try to add it later. StackBlitz cannot process my request at the moment.

Reproducer

https://stackblitz.com/edit/primevue-create-vue-typescript-issue-template-asdii5?file=src%2Fmain.ts (Made by @sceee. Thank you!)

PrimeVue version

4.0.0-beta3

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@44m0n 44m0n added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 16, 2024
@mertsincan
Copy link
Member

I didn't find any workaround yet. I can't create a reproducer right now, I will try to add it later. StackBlitz cannot process my request at the moment.

Thanks a lot! A stackblitz link really helps us a lot.

@mertsincan mertsincan self-assigned this May 16, 2024
@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 16, 2024
@mertsincan mertsincan added this to the 4.0.0-rc.1 milestone May 16, 2024
@sceee
Copy link

sceee commented May 17, 2024

Hi @mertsincan @44m0n I think this is just the same issue as #5521 and #5615 .
They have been added to the (now closed) 4.0.0-beta.3 milestone but are not closed and fixed in 4.0.0-beta.3.
Any they have stackblitz repros.

Edit:
Here is a modified Stackblitz repro using 4.0.0-beta.3:
https://stackblitz.com/edit/primevue-create-vue-typescript-issue-template-asdii5?file=src%2Fmain.ts
If you hover line 3 (import { definePreset } from 'primevue/themes';), you can see the error.

@mertsincan
Copy link
Member

Sorry for the confusion! I set a new milestone for them. I'll check and get back to you.

@mertsincan
Copy link
Member

For now, could you please try import { definePreset } from 'primevue/themes/actions'; instead of import { definePreset } from 'primevue/themes';. I'll fix this issue in RC1.

@sceee
Copy link

sceee commented May 17, 2024

Thanks @mertsincan , for now I just ignored this error using

// @ts-expect-error Remove once types are fixed
import { definePreset } from 'primevue/themes'

but that's obviously not a good "solution" you want to have in your code 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
None yet
Development

No branches or pull requests

4 participants