link1370 link1371 link1372 link1373 link1374 link1375 link1376 link1377 link1378 link1379 link1380 link1381 link1382 link1383 link1384 link1385 link1386 link1387 link1388 link1389 link1390 link1391 link1392 link1393 link1394 link1395 link1396 link1397 link1398 link1399 link1400 link1401 link1402 link1403 link1404 link1405 link1406 link1407 link1408 link1409 link1410 link1411 link1412 link1413 link1414 link1415 link1416 link1417 link1418 link1419 link1420 link1421 link1422 link1423 link1424 link1425 link1426 link1427 link1428 link1429 link1430 link1431 link1432 link1433 link1434 link1435 link1436 link1437 link1438 link1439 link1440 link1441 link1442 link1443 link1444 link1445 link1446 link1447 link1448 link1449 link1450 link1451 link1452 link1453 link1454 link1455 link1456 link1457 link1458 link1459 link1460 link1461 link1462 link1463 link1464 link1465 link1466 link1467 link1468 link1469 link1470 link1471 link1472 link1473 link1474 link1475 link1476 link1477 link1478 link1479 link1480 link1481 link1482 link1483 link1484 link1485 link1486 link1487 link1488 link1489 link1490 link1491 link1492 link1493 link1494 link1495 link1496 link1497 link1498 link1499 link1500 link1501 link1502 link1503 link1504 link1505 link1506

[Vue.js] Changing the assets directory in Vue

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.

Edit 2:

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.

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.