I'm currently working on a Javascript project that has been released as a node module. In some parts of the source code, I have used relative paths to import other files within the project:
// <this_module_path>/action/foo.js
import execution from './execution';
import types from '../types';
Additionally, I am also using the module name as a root path to import other files in the project:
// <this_module_path>/action/doSomething.js
// Using module name to import
// This is equivalent to import './helpers.js' (located in the same folder)
import executionHelpers from 'this-module/action/helpers.js';
// This is equivalent to import '../types/helpers'
import typeHelpers from 'this-module/types/helpers.js';
I am wondering how I can create a file that imports other project files using its module name rather than relative paths.