Confusing error "WARNING: No name was provided for external module 'xxx' in output.globals – guessing 'xxx'" for absolute imports
See original GitHub issueType of Issue
[x] Bug Report
[x] Feature Request
Description
When you use absolute imports inside lib you will get an absolutely confusing warning “No name was provided for external module ‘xxx’”.
Desired Behaviour
- Add supports for absolute imports (related to #916). IMO this is much much better because
- angular supported it
- in a big app ‘path/to/Component’ much more readable than
../../../../../../../../../../../../Component
- mixed style is also confusing
- Show smart warning eg “Absolute imports don’t support, please use relative.”
Version Information
ng-packagr: 10.1.2
@angular/compiler: 10.1.3
rollup: 2.28.2
tsickle:
typescript: 4.0.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (1 by maintainers)
Top Results From Across the Web
No name was provided for external module 'xxx' in output ...
Confusing error "WARNING: No name was provided for external module 'xxx' in output.globals – guessing 'xxx'" for absolute imports.
Read more >Angular No name was provided for external module ... - 博客园
No name was provided for external module 'ng-zorro-antd' in output.globals – guessing 'ngZorroAntd' 错误. 解决方法:.
Read more >Pylint features — Pylint 1.9.5 documentation
This message can't be emitted when using Python < 3.0. nonlocal-and-global (E0115): Name %r is nonlocal and global Emitted when a name is...
Read more >Defining a function in different modules - Google Groups
Code and output from julia REPL below. ... ERROR: `value` has no method matching value(::BarType) ... outside of the module.
Read more >Changelog — pytest documentation
#9823: Improved error message that is shown when no collector is found for a given file. ... pytest.collect module - import from pytest...
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 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
@LastDragon-ru Path Mappings are supported by ng-packagr. In order to understand the underlying issue, some context is needed:
UMD ID's
. Beside ESM and FESM Formats, APF specifies alsoUMD
bundles to be included.globalThis
(window
for browsers), where the name of the property will be the UMD ID and the value are all the public exports of your library (e.g. here:window['xxx']
)globalThis
ng-packagr
cannot know under which UMD ID the path mapped imports will be attached to. Said that, it will ‘guess’ a ‘name’ and thankfully warns the user about that.Recap
umdId
property in your ng-packagr config.umdModuleIds
object in your ng-packagr config., wheree key is the import identifier and the value the UMD ID of that library.To get away from the warning, just provide the same identifier you have used in the path mappings in your ng-packagr config
Real world example project (which I already linked in my previous reply):
This is also the proof, that path mappings are supported correctly 😉
cheers flash ⚡
@LastDragon-ru You may want to fix the typo 😄 in your tsconfig.json it is written with a hyphen. ,
but thats the wrong way.
Do this.
cheers flash ⚡