Fail to import sonata-project/form-extensions datepicker js when server base url is not "/"

20 views Asked by At

Context

I have a symfony application using sonata, and I have a prefix in my base url (the url of my admin dashboard is like scheme://mysite.net/myprefix/admin/dashboard).

If I use the DatePickerType in an admin form, I successfully load the app.js of the sonata-project/form-extensions package, but then I cannot the other js file chunks that are imported in app.js.

In my navigator dev tools, I can see that app.js tries to load the chunks from base domain, dropping my prefix (e.g. GET on scheme://mysite.net/bundles/sonataform/696.js for file 696.js, instead of scheme://mysite.net/myprefix/bundles/sonataform/696.js).

The result is that I have 404 errors trying to load theses assets file, and that the datepicker does not work.

What I already tried

I tried to build assets with a relative path on webpack (inspired by this PR: https://github.net/sonata-project/SonataAdminBundle/pull/7253/files), but it did not solve my problem.

My hope was that app.js would load other chunks relatively to itself in my public/bundles/sonataform directory.

I think there should be another webpack encore configuration that would work in my situation, or maybe a package configuration option in symfony that could help ?

If so I would be gald if someone could help !

0

There are 0 answers