Export "ordinary" browser library, without `default` property
See original GitHub issueIs there a way to build my project so I can use it like other ordinary libraries (like jQuery, moment.js etc.).
When I build my project and I load the file in the dist folder in an html file via a <script src="myLib.js">
element I get an object containing a default
property. E. g. myLib.default.initMyLib()
.
What I want instead is an object like this: myLib.initMyLib()
. Is this possible using this boilerplate? If so, how?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (10 by maintainers)
Top Results From Across the Web
Do not add default node , browser , require or import ... - GitHub
I'm looking into using this module to implement support for exports in Jest. Seems unfortunate that Node's defaults should be forced on ...
Read more >Understanding module.exports and exports in Node.js
In this article, I'll examine how to work with modules in Node.js, focusing on how to export and consume them. Different Module Formats....
Read more >Node Module Exports Explained - freeCodeCamp
module.exports is actually a property of the module object. ... Default exporting in a Node.js module is as simple as this:
Read more >Recipes on how to create a library that supports both browser ...
Publish an "export default" class with library name without using the default property. You want to access a class without using "default" which ......
Read more >es6 - import all named module without alias - Stack Overflow
JavaScript solution: import * as exports from 'foo'; Object.entries(exports).forEach(([name, exported]) => window[name] = exported);.
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
I can fix this with this plugin. I’ll add this very soon.
Awesome. Thanks so much @gabrielstuff !