IMPORTANT: DO NOT USE! Use import mapping instead
See original GitHub issueA similar feature to this library is already available in node as a standard: import mapping.
Not only does it allow for directory mapping, but it also allows dependency aliasing, and works for both require
and import
(ESM) WITHOUT breaking resolution behaviour in production or other libraries like using this library does.
You have been warned.
I know this sounds hateful, however, that is not my intention. My intention is instead to spread awareness about this mostly undocumented feature (it is not shown in any package manifest documentation besides node’s, and it is relatively tucked away) so people can write better software without needing to use hacky libraries like this one and without adding unnecessary dependencies.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:42
- Comments:53 (2 by maintainers)
Top Results From Across the Web
Everything You Need to Know About JavaScript Import Maps
Import maps are a new way for web pages to control the behavior of JavaScript imports, potentially enabling you to ditch your build...
Read more >in VS Code ImportError: cannot import name 'Mapping' from ...
You can solve this problem with use python 3.9 or 3.8 version. or if error from packages like python-docx or other packages about...
Read more >How to Dynamically Import JavaScript with Import Maps
The import map is a map of locations, and doesn't import any code itself. One major problem is that import maps are not...
Read more >Using ES modules in browsers with import-maps
The below chart shows that all major browsers including Edge, Chrome, ... But if you did not use import-maps , you have to...
Read more >Configuring the Style of Imports in JavaScript and TypeScript
The option “Do not import exactly from” allows you to tell the IDE that you don't want any imports that are from the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Papooch you will have to convert to using
#alias
instead of@alias
, but that’s it.I hope that helps.
@Nytelife26 , thanks for raising awareness. This was introduced “recently”, so on older versions of node, you might still want
module-alias
- therefore we probably won’t just “deprecate” the package.Would you mind opening a PR to update the README of this package, explaining that import mapping exists and should be used instead?