What is import-local?
The import-local npm package is designed to allow a globally installed package to defer to a locally installed version of itself when it is being run within a project that has that package as a dependency. This is useful for testing local changes to a package without having to publish the package or modify the global version.
Deferring to local version
This code checks if a local version of the package is available. If it is, it will use the local version and log a message to the console. Otherwise, it will proceed with the global package's code.
if (importLocal(__filename)) {
console.log('Using local version of this package');
} else {
// Code for the global package goes here
}