For some reason, I have to write code like this:
import { something } from '/Users/my-user-name/my-working-dir/my-package/src/somefile.ts';
Rollup sees /Users
thinks that's a node_modules, but not.
I can't find any rollup plugin related to this.
Now, I've written a rollup plugin to fix this, but I didn't write any plugin before, I don't know if I'm doing it right or wrong, but the output is exactly what I want:
function fixLocalImport() {
return {
name: 'fix-local-import', // this name will show up in warnings and errors
resolveId(source, importer) {
if (source.startsWith('/Users')) {
return source;
}
return null; // other ids should be handled as usually
},
load(id) {
return null; // other ids should be handled as usually
}
};
}
Am I doing anything wrong?