#Cant get a JS file to load

1 messages · Page 1 of 1 (latest)

carmine forge
#

I have the JS file in resources/js and am using `{{ asset('js/derp.js') }} in the blade file, but but the file cant be found.

cinder compass
#

Your assets need to be in the public directory, since thats the only directory which is public to the browser.

#

Generally you have the source files in resources and use a bundler like webpack or vite to build the assets into public, which you can then load into your view.

#

If you don't use a bundler just put your assets manually in public

carmine forge
#

That works! Thanks for the help

#

@cinder compass I'll keep the bundling in mind. By the way, do you know how much of a pain would it be to convert from Gulp to Vite?

cinder compass
#

Vite is overpowered

#

Gulp sucks

#

This is a new project, right?

#

Just start using Vite

#

docs vite

carmine forge
#

No, I'm porting legacy code from laravel 5.2 to 9

cinder compass
#

Yeah ok but its a new L9 install

#

So Vite is already configured for you

#

Or did you completely upgrade 5.2 to 9?

carmine forge
#

Yes, completely fresh L9. Just trying to manually port the legacy code

cinder compass
#

Yeah gotcha

#

Just leave your gulp stuff in the old project and start using Vite here

#

The docs I just linked will help you out

carmine forge
#

Perfect, thank you so much!