1 | const path = require('path');
|
2 | const slash = require('slash');
|
3 |
|
4 | module.exports = (from, to) => {
|
5 | if (!from) return to;
|
6 | const importPath = slash(path.relative(path.dirname(from), to));
|
7 | return /\.\.\//.test(importPath) ? importPath : `./${importPath}`;
|
8 | };
|