-
Hi, This is what I want: in production mode, I want all the react assets created from npm build to be placed in the wwwroot/react folder. To do that, I set
is not rendered properly and I get this:
In program.cs I have: builder.Services.AddViteServices(new ViteOptions
{
Manifest = "assets.manifest.json",
Base = "/react",
}); assets.manifest.json is created in {
"Account/Agreement/main.jsx": {
"file": "js/agreement.5b9423ef.js",
"imports": [
"_client-chunk.js"
],
"isEntry": true,
"src": "Account/Agreement/main.jsx"
},
"_client-chunk.js": {
"file": "js/client-chunk.js"
}
} I checked the source code, and at this line the key is prefixed with the base path. But if add the base path in front, it works in Production mode but it stops working in Development mode: Any idea on how to fix it? Edit: just an explanation why I want to put these files in a different folder. wwwroot contains other css files, images, scripts etc. which are referenced in the pages that don't use react, and it doesn't make sense to delete the content of this folder every time I do the Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi. You forgot to set the |
Beta Was this translation helpful? Give feedback.
-
Thanks. I cannot get it to work without having 2 script references, one for production and one for development, or only one where for the production one I add the dist prefix as per the example. |
Beta Was this translation helpful? Give feedback.
Hi. You forgot to set the
base
option in yourvite.config.ts
file.See this example in the wiki.