I try to work with VueJs and PrimeVue in an existing Asp.Net Core project but I can't import the module. I guess my problem comes from the configuration of my project but I don't know how to solve it.
My project is an asp.net core project created in VS 2022. I installed npm with no particular option. After that, I installed PrimeVue and PimeIcons as it's shown on their site, that is :
npm install primevue@^3.17.0 --save
npm install primeicons --save
So my app tree is like this :
Project root folder
│ appsettings.Development.json
│ appsettings.json
│ ERP.csproj
│ package-lock.json
│ package.json
│ Program.cs
│ tsconfig.json
│
├───node_modules
│ │ .package-lock.json
│ ├───estree-walker
│ ├───jquery
│ ├───magic-string
│ ├───nanoid
│ ├───picocolors
│ ├───postcss
│ ├───primeicons
│ ├───primevue
│ ├───source-map
│ ├───source-map-js
│ ├───sourcemap-codec
│ └───vue
├───obj
├───Properties
├───Views
└───wwwroot
│ favicon.ico
├───css
├───js
├───lib
└───TSScripts
Then I make the import as their site says :
import PrimeVue from 'primevue/config';
import 'primeicons/primeicons.css';
But when I launch the app from VS, I have this error :
Uncaught TypeError: Failed to resolve module specifier "primevue/config". Relative references must start with either "/", "./", or "../".
so I tried :
import PrimeVue from './primevue/config';
import './primeicons/primeicons.css';
result :
Failed to load resource: the server responded with a status of 404 () :7080/js/Partenaires/primevue/config:1
Failed to load resource: the server responded with a status of 404 () :7080/js/Partenaires/primeicons/primeicons.css:1
It seems that the files should be in the wwwroot folder instead of the root/node_modules folder.
I had a similar problem with my TypeScript files, there were in a folder in the root and the app didn't find them. I had to move the folder in the wwwroot folder to solve it without being sure it's the good way to do (see : TypeScript folder is missing when launching app)
Can someone explain me what should I do to solve this problem ?
Thank you.
Philippe