Bilibili-Evolved/registry/webpack/id.js
2021-10-26 13:19:37 +08:00

8 lines
243 B
JavaScript

/** Runs both in Node.js and browser (without path module).
* Paths are case-sensitive.
*/
module.exports.getId = (root, entry) => {
const relative = entry.replace(root, '').replace(/\\/g, '/')
return relative.replace(/\/[^\/]+$/, '')
}