I have developed an npm package called example-package
. Typically, users would import it like this:
import RootModule from "example-package";
However, I also have a file nested within the package structure.
Package Root > src > Feature > index.js
If a user needs to import this Feature module, they would usually do:
import Feature from "example-package/src/Feature";
Is there a way for me to simplify this process and allow users to import the Feature module using a shorter path like this?
import Feature from "example-package/Feature";
To clarify, the Feature
module exports multiple options - { A, B ..}
. I want users to be able to import the entire module with just one slash in the path, without having to extract individual options later!