Map directories/files to node_modules
See original GitHub issueExpected Behavior
Normally we have dependencies (like js-yaml, c3js,…) installed in node_modules. It should be possible to define kind of mapping:
"my/library/thirdparty/ext.min.js": "node_modules/ext/dist/ext.min.js"
This mapping setting should be used in “ui5 serve” & “ui5 build”.
Current Behavior
It’s only possible to define mapping to the src
, test
and webapp
directories.
Steps to reproduce the issue
Context
Affected components (if known)
Log Output / Stack Trace
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How can I make multiple projects share node_modules ...
You absolutely can share a node_modules directory amongst projects. From node's documentation: If the module identifier passed to require() is not a native ......
Read more >map-folder - npm
Create a JSON representation of a folder structure tree. ... Start using map-folder in your project by running `npm i map-folder`.
Read more >CommonJS modules | Node.js v19.3.0 Documentation
Core modules; Cycles; File modules; Folders as modules; Loading from node_modules folders; Loading from the ... The Module object; Source map v3 support ......
Read more >Working with folders in Node.js
The Node.js fs core module provides many handy methods you can use to work with folders. Check if a folder exists. Use fs.access()...
Read more >The magic behind npm link - Medium
Note: You can specify a NODE_PATH environment variable to make Node.js search for modules in other folders, but it is not recommended. Loading...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
+1 on this feature. I want to use highcharts in a library. Unfortunately they have a different folder structure (which you can see here) where the main library file is on root level. So there mapping has to point to
./
. However this brakes the build as the builder also processes all subfolders and the./es-modules
-folder contains.js
files that cannot be processed (see and example error below). And all I need is actually just a single js-file from the highcharts library. So even if the processing of the files wouldn’t fail I don’t want it to include them in the build.if someone elese stumbles across this issue and there is no better fix yet: I am using patch-package in order to automatically delete all files except for the ones I need. Not nice but it works. Hope this is not yet another of those permanent “temporary workarounds”.
@aktivalux I guess an exclude configuration as discussed here could already help. However I see that the per-file mapping would be more useful in this case.