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.

Enhancements to module exports

See original GitHub issue

Enhance exports Currently modules/classes can only be imported from the single file they are exported from.

Users may benefit from importing the whole library:

import ol from 'ol';
const layer = new ol.layer.Tile();

… or a single namespace:

import control from 'ol/control'; 
const OverviewMap = new control.OverviewMap();

Also the naming of default exports could be improved (i.e. append the name of the containing directory’) so IntelliSense finds them more easily, e.g.

class OSMSource extends XYZ {}; // instead of `class OSM extends XYZ`
export default OSMSource

See suggestion of @ahocevar for reference: https://github.com/openlayers/openlayers/issues/9358#issuecomment-475170787

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
KaiVollandcommented, Mar 26, 2019

Ah ok. Got it. I just have to keep /src/ol/source.js as it is.

0reactions
stale[bot]commented, May 25, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js Module Exports Explained | Scout APM Blog
This post will cover the use of modules in Node.js, what they are, why they are essential, and how to export and import...
Read more >
Understanding Node.js Module Exports - Atatus
This article will go through what module exports are, ... In the world of Javascript, these enhancements come in a variety of formats....
Read more >
module.exports colliding / being overwritten in node.js ...
I think I'm badly misunderstanding how to use module.exports. It seems every module is overwriting what the last one spit out. app.js:
Read more >
NodeJS Export and Import Modules - DigitalOcean
NodeJS Export and Import Modules · To export all these three, we have to use same technique. · Here we have exported PI...
Read more >
ECMAScript modules | Node.js v19.3.0 Documentation
When importing CommonJS modules, the module.exports object is provided as the default export. Named exports may be available, provided by static analysis as...
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