This works fine when I manually request a file using require , however the moment I use the same request, but change the string so that it breaks into variables that it fails.
This works great:
module.exports = (function() { var $svg = require('svg-inline!../../assets/svgs/global/connected.svg'); console.log($svg); }());
However, if I did this:
module.exports = (function() { var $path = '../../assets/svgs/global/'; var $svg = require('svg-inline!'+$path+'connected.svg'); console.log($svg); }());
It does not work and says inside the console:
Uncaught Error: Cannot find module "."
I think my question is why you cannot concatenate strings like I am here?
source share