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

CSS file paths in Vite 3 manifest broken on Windows #101

Closed
AhsanAbrar opened this issue Jul 21, 2022 · 14 comments
Closed

CSS file paths in Vite 3 manifest broken on Windows #101

AhsanAbrar opened this issue Jul 21, 2022 · 14 comments
Assignees

Comments

@AhsanAbrar
Copy link

AhsanAbrar commented Jul 21, 2022

  • Laravel Vite Plugin Version: 0.5.0
  • Laravel Version: 9.21.3
  • Node Version: 16.13.2
  • NPM Version: 8.1.2
  • Host operating system: Windows
  • Web Browser & Version: Chrome - Version 103.0.5060.134 (Official Build) (64-bit)
  • Running in Sail / Docker: No

Description:

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,
        }),
    ],
});
@vite(['resources/css/app.css', 'resources/js/app.js'])

After running this command:

npm run build

Getting this error:

Unable to locate file in Vite manifest: resources/css/app.css.

Steps To Reproduce:

I have done some research on it.

there is an issue in the manifest.json file.

{
  "resources/js/app.js": {
    "file": "assets/app.8fe7c9ab.js",
    "src": "resources/js/app.js",
    "isEntry": true
  },
  "resources/css\\app.css": {
    "file": "assets/app.8794147c.css",
    "src": "resources/css\\app.css"
  }
}

Screenshot_57

and in the Vite.php this manifest key is not matching.

Screenshot_58

that's why js files working fine and css files having issues.

please fix this, thanks.

@driesvints
Copy link
Member

Using Windows?

@driesvints
Copy link
Member

Please fill out the FULL issue template.

@AhsanAbrar
Copy link
Author

Yes, using Windows

@driesvints
Copy link
Member

Can you please fill out the remaining parts of the issue template?

- Host operating system: Windows / Linux / macOS #.#.#
- Web Browser & Version: ?
- Running in Sail / Docker: No|Sail|Docker

@AhsanAbrar
Copy link
Author

I have updated it.

@schonhoff
Copy link

schonhoff commented Jul 21, 2022

Hi,

same error for me after updating to plugin version 0.5.0 and vite 3.0.2

Laravel Vite Plugin Version: 0.5.0
Laravel Version: 9.21.4
Node Version: 16.14.2
NPM Version: 8.13.2
Host operating system: Windows
Web Browser & Version: Chrome - Version 103.0.5060.134 (Offizieller Build) (64-Bit)
Running in Sail / Docker: No

Found this issue to the error:
#19

@jessarcher
Copy link
Member

Hi @AhsanAbrar,

As of version 3, Vite is now responsible for adding CSS files to the manifest. In version 0.5.0 of this plugin, we removed our code that manually added these entries.

Therefore it seems like this is an issue with Vite 3 rather than this plugin.

If you're using a front-end framework like Vue, then I would recommend importing your CSS via JavaScript instead of having a CSS entry point. Be sure to also update your @vite directive to only include the JavaScript entry point.

Otherwise, I would suggest using Vite 2 with version 0.4.0 of this plugin until this issue is resolved upstream.

@jessarcher jessarcher changed the title Vite CSS bug for production CSS file paths in Vite 3 manifest broken on Windows Jul 22, 2022
@driesvints
Copy link
Member

Thanks @jessarcher

@timacdonald
Copy link
Member

I've opened a PR to address this in Vite. I would absolutely love if someone could test this fix for me as I cannot actually test this fix locally.

See: vitejs/vite#9353

@timacdonald
Copy link
Member

The fix for this has been merged upstream and I assume will be tagged in Vite v3.0.4 sometime soon.

@timacdonald
Copy link
Member

v3.0.4 of Vite has now been tagged.

Please update to the latest version and this issue should be resolved for you.

See: https://github.com/vitejs/vite/blob/v3.0.4/packages/vite/CHANGELOG.md

@AhsanAbrar
Copy link
Author

@timacdonald You did a great job! Thanks

@schonhoff
Copy link

Thanks for the fix! It worked!!!

@timacdonald
Copy link
Member

Glad it is sorted for you, folks!

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

No branches or pull requests

5 participants