How to make the Directory Work into /opt/ instead of dir in AWS Lambda?

My Question is this

it’s annoying that eslint doesn’t want a dynamic

const test = require(${process.env.DIR}/sample.js);

so I usually hardcode it
does anybody here have any Idea to actually make the

const test = require(“/opt/sample.js”);

in local?
so I won’t manually change it every time we deploy ?