I have a module with two views, I need that each view have its own assets files, because of this I wrote a AssetBundle called DashboardAsset for my dashboard view, this is the code.
class DashboardAsset extends AssetBundle
{
public $sourcePath ='@asketchFront/assets/resources/';
public $basePath = '@webroot';
public $baseUrl = '@web';
public $js =
[
"js/src/dashboard.js"
];
public $css =
[
"css/dashboard.css",
'font-awesome/css/font-awesome.min.css',
];
}
Then in my dashboard view I put the following code line:
DashboardAsset::register($this);
afertward when I want to see my page, the following error messages are displayed in the console
GET http://localhost/js/src/dashboard.js localhost/:478
GET http://localhost/css/dashboard.css localhost/:19
GET http://localhost/font-awesome/css/font-awesome.min.css
Why this happens??
I solved the problem removing the basepath and the baseurl attributes