question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export "ordinary" browser library, without `default` property

See original GitHub issue

Is 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:closed
  • Created 7 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
jamespleasecommented, Jul 19, 2016

I can fix this with this plugin. I’ll add this very soon.

0reactions
jamespleasecommented, Sep 20, 2016

Awesome. Thanks so much @gabrielstuff !

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found