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

Missing Script Tag in Deployed Azure Build #139

Open
RacerDelux opened this issue Dec 7, 2024 · 4 comments
Open

Missing Script Tag in Deployed Azure Build #139

RacerDelux opened this issue Dec 7, 2024 · 4 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@RacerDelux
Copy link

Describe the bug
I managed to get a demo project deployed into a test enviornment using azure.
The HTML page shows up just fine, but the script and style links are missing.
image

If I but my IDE into release mode and change the environment to anything but development, it runs fine.
When I inspect the built files, I do see the css and javascript files in the wwwroot folder.

I am going to attach the .zip of the built demo project as well.
DotNetVite-4.zip

To Reproduce

  1. Download the included DotNetVite-4.zip file
  2. Use your preferred method to run the server - note this is built for windows

Expected behavior
To see the below screen:
image

Current behavior
image

Device (please complete the following information):

  • OS: Windows
  • IDE/Editor: Rider
@RacerDelux RacerDelux added the bug Something isn't working label Dec 7, 2024
@Eptagone
Copy link
Owner

Eptagone commented Dec 7, 2024

Hi, I don't see the manifest file. Folders starting with a dot are ignored by default. Make sure you are including the .vite folder in your csproj file like this example or change the manifest name/location.

<ItemGroup>
    <!-- Without this line your manifest.json won't be copied on publish because dot folder/files are ignored by default -->
    <Content Include="wwwroot\.vite\**" />
</ItemGroup>

The manifest file is required, otherwise, the manifest service cannot locate the asset files.

@RacerDelux
Copy link
Author

RacerDelux commented Dec 7, 2024

The manifest file is required, otherwise, the manifest service cannot locate the asset files.

I have that in my csproj file

Here is the project file:
Project.zip

@Eptagone
Copy link
Owner

Eptagone commented Dec 7, 2024

It's true. As I can see, if there are no files in the wwwroot folder yet, the .vite folder is ignored anyway when publishing, ignoring the content include configuration.
Mmm, I'm not sure if it's a bug of msbuild or we are forgetting something. An extra researching will be required.

But for now, you can change the manifest name to avoid the dot folder and it should work.

Example:

// Program.cs
// Add the Vite services.
builder.Services.AddViteServices(options =>
{
    options.Manifest = "vite-manifest.json"; // Here
    options.Server.AutoRun = true;
    options.Server.Https = true;
});
// vite.config.ts
const config: UserConfig = {
    // ...
    build: {
        // ...
        manifest: "vite-manifest.json", // Here
    }
};

@Eptagone Eptagone added the help wanted Extra attention is needed label Dec 7, 2024
@RacerDelux
Copy link
Author

@Eptagone That did indeed work. Looks like there is a bug somewhere with the extra folder being generated I think. If the wwwroot folder is missing.

I had a similar issue with the https certs, and my fix for those was to make it so it only had one containing folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants