In Node.js, it’s possible to import modules by specifying an absolute path, such as /lib/foo/bar.js. However, this approach can
limit the portability of your code, as it becomes tied to your computer’s file system. This could potentially lead to problems when the code is
distributed, for instance, via NPM packages. Therefore, it’s advisable to use relative paths or module names for importing modules to enhance
the portability and compatibility of your code across different systems.
Replace the absolute path with one that is relative to your current file.
import { foo } from '/home/project/api/bar.js';
import { foo } from '../api/bar.js';
No issue will be raised when an import path starts with an exact build-tool root alias segment such as /@/, /$/, or
/#/. These patterns are commonly used to reference project-root modules rather than filesystem absolute paths.
import { apiClient } from '/$/api/client';
import AppHeader from '/@/components/AppHeader';
import { setupPlugins } from '/#/plugins';