Closed JoshOldenburg closed 4 years ago
What happens when you use remoteScript
in this way?
For the style
call, can you just move the CSS out of the public
directory and put it somewhere else... Typically this kind of thing would be in a package?
Calling remoteScript
fails when ScriptController
calls filemtime
on the URL instead of the file (the same way script
and style
fail).
We could move this into a package. We haven't separated it out for simplicity as these components are only used in one project. (We're currently in the process of moving to Vapor so we had not encountered this issue previously.)
Well, I mean I'm just curious why when using remoteScript you would ever hit ScriptController at all? Isn't remoteScript for links to outside URLs? And, if given a fully-qualified URL it would never hit ScriptController?
I must have typed the wrong function during my initial tests and because of that I didn't look in the layout blade file. We've resolved this in our project by using the correct functions. Sorry for the confusion.
@JoshOldenburg what was the correct function you used?
i currently have this and its not working with Vapor it works locally and on EC2.
Nova::script('settings', __DIR__ . '/../dist/js/tool.js');
Nova::style('settings', __DIR__ . '/../dist/css/tool.css');
Description:
Custom scripts included with
Nova::script()
or custom stylesheets included withNova::style()
cannot be included when running on Laravel Vapor. On Vapor the assets are only held on Cloudfront so they can't be directly passed to the client byScriptController
(https://github.com/laravel/nova/blob/3.0/src/Http/Controllers/ScriptController.php).The
Nova::remoteScript()
method also doesn't work when usingasset()
as the argument asScriptController
runsfilemtime
on a URL in that case, which fails. (remoteScript()
is functionally not different fromscript()
in this case and I just usedstyle()
as there is noremoteStyle()
method.)Detailed steps to reproduce the issue on a fresh Nova installation:
Set up a Laravel Vapor environment. Then add the following to the
NovaServiceProvider
, where the script and style paths are updated to be any JS/CSS file in the public directory.It also does not work without the wrapping
asset()
call, for instance,Nova::script('custom-script', __DIR__.'/../../public/js/nova.js')
.