-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Cannot find module '@primeuix/styled' from 'node_modules/primeng/fesm2022/primeng-themes.mjs' #16353
Comments
This should have been installed transitively, we'll review, thank you. |
It's only in my tests that it's failing, the app runs just fine. Plus it's
there in my node modules folder so no idea why it doesn't see it.
…On Sat, Sep 7, 2024, 7:52 AM Cagatay Civici ***@***.***> wrote:
This should have been installed transitively, we'll review, thank you.
—
Reply to this email directly, view it on GitHub
<#16353 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABVTXGCDKAQVUW625N7ESCTZVLSGDAVCNFSM6AAAAABNZEPV22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGE3DGMBUGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Interesting! Can you share a repo that includes your config? Thanks, |
Unfortunately it's company code that I can't share. This is the package.json content though: {
"name": "x",
"version": "0.0.1",
"scripts": {
"ng": "ng",
"build": "ng build shell && ng build reporting && ng build mfe2",
"watch": "ng build --watch --configuration development",
"test": "jest",
"test:since-dev": "jest --changedSince=origin/dev --coverage",
"test:watch": "jest --watch",
"coverage": "jest --coverage",
"serve:ssr:pom-portal": "node dist/pom-portal/server/server.mjs",
"lint": "ng lint",
"ci-install": "npm ci",
"ci-build": "npm cache verify && ng build shell",
"ci-lint": "npm run lint",
"ci-audit": "npm audit --audit-level=high",
"ci-test": "npm run test",
"ci-e2e": "npm run ng e2e",
"sonar-scanner": "sonar-scanner",
"prepare": "husky"
},
"private": true,
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
},
"dependencies": {
"@angular/animations": "^18.1.3",
"@angular/cdk": "^18.2.3",
"@angular/common": "^18.2.3",
"@angular/compiler": "^18.2.3",
"@angular/core": "^18.2.3",
"@angular/forms": "^18.2.3",
"@angular/platform-browser": "^18.2.3",
"@angular/platform-browser-dynamic": "^18.2.3",
"@angular/platform-server": "^18.2.3",
"@angular/router": "^18.2.3",
"@angular/ssr": "^18.2.3",
"@fortawesome/fontawesome-free": "^6.6.0",
"chart.js": "^4.4.4",
"es-module-shims": "^1.5.12",
"express": "^4.18.2",
"font-awesome": "^4.7.0",
"ngx-cookie-service": "^18.0.0",
"powerbi-client-angular": "^3.0.5",
"primeicons": "^7.0.0",
"primeng": "^18.0.0-beta.1",
"rxjs": "~7.8.0",
"tslib": "^2.7.0",
"xml-to-json-util": "^1.0.1",
"zone.js": "~0.14.10"
},
"devDependencies": {
"@angular-architects/native-federation": "^18.1.3",
"@angular-devkit/build-angular": "^18.1.4",
"@angular-eslint/builder": "18.3.0",
"@angular-eslint/eslint-plugin": "18.3.0",
"@angular-eslint/eslint-plugin-template": "18.3.0",
"@angular-eslint/schematics": "18.3.0",
"@angular-eslint/template-parser": "18.3.0",
"@angular/cli": "^18.1.4",
"@angular/compiler-cli": "^18.2.3",
"@softarc/eslint-plugin-sheriff": "^0.17.0",
"@softarc/sheriff-core": "^0.17.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.12",
"@types/node": "^18.18.0",
"@types/webpack-env": "^1.18.5",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"angular-eslint": "18.3.0",
"eslint": "^9.8.0",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.1.5",
"jest": "^29.7.0",
"jest-preset-angular": "^14.2.2",
"lint-staged": "^15.2.10",
"ng-mocks": "^14.13.1",
"ng-packagr": "^18.2.1",
"prettier": "3.3.3",
"primeflex": "^3.3.1",
"ts-jest": "^29.2.5",
"typescript": "^5.5.4",
"typescript-eslint": "^8.4.0"
}
} |
Update. I'm digging through the jest-resolve package to try to focus in on the issue. Not sure how much help this is, but the Jest function
I will update this post as I find more. Update 2: If I change the node-modules
New error is
Update 3: Continuing that thread, by adding these lines to the package.json of both styled "exports": {
".": {
"types": "./index.d.mts",
"default": "./index.mjs",
"import": "./index.mjs"
} utils "exports": {
".": {
"types": "./index.d.mts",
"import": "./index.mjs",
"default": "./index.mjs"
},
"./*": {
"types": "./*/index.d.mts",
"import": "./*/index.mjs",
"default": "./*/index.mjs"
}
}, |
@cagataycivici Have you been able to replicate this one? My 'fix' works for me but isn't a valid approach since my gitlab pipelines are failing the testing since they are doing a clean node-modules install. |
Far from my area of expertise so forgive my naivete. This appears to be a CommonJS vs ESM issue - Jest has only experimental support for ESM. I'm trying to find the Jest settings for it, but adding 'require' or 'default' values to the PrimeNG export settings is resolving the issue. It doesn't look like support for CommonJS was dropped so I'm still at a loss as to why this just stopped working. |
@ratsey I just started porting my app to PrimeNG v18 and I had the same issue. I was able to fix the tests by making the following changes to my jest.config.ts file. I hope this helps you.
|
Thanks a lot @ratsey, Fixed in primeuix v0.1.2. |
@mertsincan the primeng repo still needs to update the dependency to use 0.1.2 tho |
Fixed in 18.0.0-beta.2 76a86f9 |
|
Describe the bug
Recognising that I'm using ^18.0.0-beta.1, although my code is running fine with the new themeing architecture, my tests are failing. I see that I do have @primeuix/styled in my node_modules, so do I need to somehow boostrap the theming in the same way that I do now in the app.component.ts with PrimeNGConfig?
Environment
Angular build is downgraded whilst waiting for a federated modules fix
Reproducer
No response
Angular version
18.1.4
PrimeNG version
18.0.0-beta.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
20.16.0
Browser(s)
Edge 128.0.2739.63 (Official build) (64-bit)
Steps to reproduce the behavior
Component Template
Component Code
Component Test
Actual Test Output
Expected behavior
Tests run without exception
The text was updated successfully, but these errors were encountered: