You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uncaught TypeError: The specifier “fos-router” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”. #491
I have this error in my Symfony 6.4 project since many months but I can't fix it. Uncaught TypeError: The specifier “fos-router” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.
In every JavaScript files which I use, I import FosJsRoutingBundle like this : import Router from 'fos-router';
The library is found because I can display some Tree chart.
With a colleague, we tried with ./ , ../ and / whereas there no change. We create a file router.js to import FosJsRoutingBundle. This router.js
import Router from 'fos-router';
export default {Router};
The file router.js in the root of my javascript folder, in assets/javascript/router.js
Today FosJsRoutingBundle works on all pages except one. However, I import FosJsRoutingBundle in the same way in every page which need it.
test.js
We check the asset import in Twig, for example :
let actionAccountButtons = document.getElementsByClassName("actionAccountButton");
console.log(actionAccountButtons);
The 2 test files work but index.js which contains an import to Fos display this error in the console : Uncaught TypeError: The specifier “fos-router” was a bare specifier, but was not remapped to anything. Relative module specifiers must start with “./”, “../” or “/”.