The path module from Node.js, but agnostic about runtime.
Warning
This implements POSIX style paths only, not windows.
npm i -S @substrate-system/pathimport { path } from '@susbtrate-system/path'
const filename = 'logo.png';
const logo = path.join('./assets/img', filename);
// => './assets/img/logo.png'
document.querySelector('#logo').src = logo;See the Node.js path docs. @substrate-system/path currently matches the Node.js 10.3 API. @substrate-system/path only implements the POSIX functions, not the win32 ones.