TIL properly adding files into Vue
POSTED ON:
TAGS: vue
This probably happens to me every other Vue Project. So might as well right about it.
*WRONG: *
var audio = new Audio('./file.mp3');
This gets decoded as a string.
*CORRECT: *
var audio = new Audio(require('./file.mp3'));
Webpack will ensure the proper path and filename for that resource.
Via https://stackoverflow.com/a/51126831/4096078
Related TILs
Tagged: vue