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

Vite asset misses some files when processed #132

Closed
Rizky92 opened this issue Aug 30, 2022 · 9 comments
Closed

Vite asset misses some files when processed #132

Rizky92 opened this issue Aug 30, 2022 · 9 comments
Assignees
Labels

Comments

@Rizky92
Copy link

Rizky92 commented Aug 30, 2022

  • Laravel Version: 9.26.1
  • PHP Version: 8.1.6
  • Database Driver & Version: N/A

Others:

  • NodeJS v16
  • OS Windows 10

I followed the documentation about processing static assets to process my static asset files. However, some files were missed by vite.

My files contains a lot of repeated filenames and identical structure, with only difference is the origin name of the directory, like example:

resources/
  static/
    subdomain-a/
      logo.png
      logo-alternate.png
      ...
    subdomain-b/
      logo.png
      logo-alternate.png
      ...
    subdomain-c/
      logo.png
      logo-alternate.png
      ...
...

Repo: https://github.com/Rizky92/bug-report

@Rizky92 Rizky92 changed the title Vite asset misses some files in manifests Vite asset misses some files when processed Aug 30, 2022
@timacdonald
Copy link
Member

Hey @Rizky92,

Thanks so much for providing the repo to test against. It really helps us.

This is a known issue that we have a fix for, bu in the meantime you will need to make the following adjustment to your vite config:

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: ['resources/css/app.css', 'resources/js/app.js'],
            refresh: true,
        }),
    ],
+   build: {
+       assetsInlineLimit: 0
+   }
});

You might wanna keep an eye on this PR: #131. Once it is merged and tagged you can then remove that config option.

Thanks again and sorry you ran into this issue.

@Rizky92
Copy link
Author

Rizky92 commented Aug 30, 2022

Thank you @timacdonald.
I have tested your advice. It is now works for image files. Unfortunately, it didn't work for .manifest files.

Is there any chance that vite perform checks for specific file types?

@timacdonald
Copy link
Member

I didn't notice them missing. Let me take a look at those for you.

@timacdonald timacdonald reopened this Aug 30, 2022
@timacdonald timacdonald self-assigned this Aug 30, 2022
@driesvints driesvints added the bug label Aug 30, 2022
@driesvints driesvints transferred this issue from laravel/framework Aug 30, 2022
@driesvints
Copy link
Member

Transferred this to the vite-plugin repo.

@timacdonald
Copy link
Member

timacdonald commented Aug 31, 2022

@Rizky92 whoa. that was a rabbit hole I just went down on this one!

It seems that files that are 100% identical are causing this issue.

I've created a PR to Vite in an attempt to fix this, although I'm not 100% sure if this is the "correct" fix from a Vite perspective (build tools are hard).

Attempted fix: vitejs/vite#9928

For now you may have to create a "shared" directory and put any shared resources across clients in there (i.e. any files that are globed that exactly identical).

Hopefully we can get a resolution for this via Vite, but there isn't anything we can do in our plugin to fix this one. It will need upstream changes.

@Rizky92
Copy link
Author

Rizky92 commented Aug 31, 2022

Thank you very much @timacdonald.
I'll try to work around that one. I've checked that apparently the only file with 100% identical was the manifest file.

Once again, thank you.

@timacdonald
Copy link
Member

Will close this as this isn't a bug in the plugin. We can follow along upstream and see if we can get anything sorted.

@timacdonald
Copy link
Member

Looks like the PR is being considered for Vite 3.1

@timacdonald
Copy link
Member

Just a heads up that the upstream fix for this has now been tagged in vite 3.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants