I am working on symfony project (version 3.4) I would like to access to a route from javacsript file. I have seen on symfony documentation that I can use FOSJsRoutingBundle. I have followed the doc to install it and configure it but when I try to access to my website, I get this error :Uncaught SyntaxError: Unexpected identifier. which is related to this line added to my js file :
import Routing from '../../vendor/friendsofsymfony/jsrouting-bundle/Resources/public/js/router.min.js';
this is what I get in dev.log file :
[2018-11-30 22:50:53] request.INFO: Matched route "ens_category_page". {"route":"ens_category_page","route_parameters":{"_controller":"JobeetBundle\\Controller\\CategoryController::indexAction","_route":"ens_category_page"},"request_uri":"http://localhost:8888/jobeet/web/app_dev.php/categories","method":"GET"} []
[2018-11-30 22:50:53] security.INFO: Populated the TokenStorage with an anonymous Token. [] [] [2018-11-30 22:50:54] doctrine.DEBUG: SELECT t0.id AS id_1, t0.name AS name_2 FROM category t0 [] [] [2018-11-30 22:50:55] request.INFO: Matched route "fos_js_routing_js". {"route":"fos_js_routing_js","route_parameters":{"_controller":"fos_js_routing.controller:indexAction","_format":"js","_route":"fos_js_routing_js"},"request_uri":"http://localhost:8888/jobeet/web/app_dev.php/js/routing?callback=fos.Router.setData","method":"GET"} [] [2018-11-30 22:50:56] request.INFO: Matched route "_wdt". {"route":"_wdt","route_parameters":{"_controller":"web_profiler.controller.profiler:toolbarAction","token":"b81260","_route":"_wdt"},"request_uri":"http://localhost:8888/jobeet/web/app_dev.php/_wdt/b81260","method":"GET"} []