I’m working on a project that was created using the vue.js cli 3.0. And on creation a src/assets folder is also made. This folder can include some images for example.
Is it possible to change the path of the assets to something different?
I tried changing the assetsDir setting in vue.config.js. But this only changes the output path in the build.
I should note that I would like to load assets based on a “vendor” environment variable. So if I set this to vendorX it should load src/assets/vendorX and with vendorY it should load src/assets/vendorY.
It appears that the directory name doesn’t matter to the vue.js Cli. I changed the assets folder name to vendors. But my guess is that vue.js includes all resources files in src by default. So I’m now looking for a way to change this, or maybe find a different solution.
If the assets folder was setup with an alias, that would be found in webpack.config, however the vue-cli appears to create a project with hardcoded paths to the assets. Try changing the src path for the assets across all files to ./assetsDir/myImg.png.