primevue icon indicating copy to clipboard operation
primevue copied to clipboard

[PrimeVue V4.0.0-beta.1] Cannot find declaration file for module for Aura theme and Primeone base

Open niek-o opened this issue 10 months ago • 2 comments

Describe the bug

Typescript can't find declaration modules for "primevue/themes/primeone/aura", "primevue/themes/primeone" and definePreset() fails to import, because it says primevue/themes/index.d.ts is not a module.

Reproducer

https://stackblitz.com/edit/primevue-create-vue-issue-template-ydyslb?file=tsconfig.node.json,tsconfig.json,tsconfig.app.json,package.json,src%2FApp.vue,src%2Fmain.ts

PrimeVue version

4.0.0-beta.1

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Open stackblitz example
  2. Run npm run build
  3. Build will fail with the following error:
~/projects/primevue-create-vue-issue-template-ydyslb 4s
❯ npm run build

> [email protected] build
> run-p type-check "build-only {@}" --


> [email protected] type-check
> vue-tsc --build --force


> [email protected] build-only
> vite build

vite v5.0.12 building for production...
transforming (258) node_modules/primevue/icons/angledown/index.essrc/main.ts:7:22 - error TS7016: Could not find a declaration file for module 'primevue/themes/primeone'. '/home/projects/primevue-create-vue-issue-template-ydyslb/node_modules/primevue/themes/primeone/index.cjs.js' implicitly has an 'any' type.

7 import PrimeOne from 'primevue/themes/primeone';
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~

src/main.ts:8:18 - error TS7016: Could not find a declaration file for module 'primevue/themes/primeone/aura'. '/home/projects/primevue-create-vue-issue-template-ydyslb/node_modules/primevue/themes/primeone/aura/index.cjs.js' implicitly has an 'any' type.

8 import Aura from 'primevue/themes/primeone/aura';
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/main.ts:9:30 - error TS2306: File '/home/projects/primevue-create-vue-issue-template-ydyslb/node_modules/primevue/themes/index.d.ts' is not a module.

9 import { definePreset } from 'primevue/themes';
                               ~~~~~~~~~~~~~~~~~


Found 3 errors.

npm ERR! code EIO
npm ERR! syscall write
npm ERR! errno -5
npm ERR! EIO: i/o error, write

npm ERR! A complete log of this run can be found in: /home/.npm/_logs/2024-04-19T06_40_03_357Z-debug-0.log
✓ 263 modules transformed.
ERROR: spawn /usr/local/bin/node EIO
npm ERR! code EIO
npm ERR! syscall write
npm ERR! errno -5
npm ERR! EIO: i/o error, write

npm ERR! A complete log of this run can be found in: /home/.npm/_logs/2024-04-19T06_40_02_549Z-debug-0.log
jsh: spawn npm EIO

Expected behavior

The app should not fail to build when building.

niek-o avatar Apr 19 '24 06:04 niek-o

This duplicates #5521

sceee avatar May 03 '24 11:05 sceee

Thanks a lot for your report! I'll fix it for the next release.

mertsincan avatar May 03 '24 16:05 mertsincan

Hello,

We changed a lot of things related to theming API. Please try 4.0.0-rc.1. Also, I updated your sample; https://stackblitz.com/edit/primevue-create-vue-issue-template-i3nqsv?file=tsconfig.app.json,package.json,src%2FApp.vue,src%2Fmain.ts

Doc; https://primevue.org/theming/styled/#theme

Best Regards,

mertsincan avatar Jun 14 '24 08:06 mertsincan