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.

Expose all classes exports at top level

See original GitHub issue

for instance, export LoaderVolumes instead of Loaders.Volumes.

That allows us to use named imports:

import {LoaderVolumes} from 'ami.js';

otherwise it is pretty chaotic:

import AMI from 'ami.js'

...
const LoaderVolumes = AMI.Loaders.Volumes;

Main benefit will be at compilation time where bundler will only import the required deps (LoaderVolumes) instead of the full package.

1 - ami.js

...
export * from './geometries/Geometries.js';
...

2- geometries.js:

...
export {GeometriesSlice} from './geometries.slice.js';

3- geometries.slice.js

class GeometriesSlice

...

export {GeometriesSlice}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasRannoucommented, Oct 2, 2017

that’d be great! I didn’t know about jscodeshift, please do not hesitate if you have any question!

thanks @marcinlichwala

0reactions
NicolasRannoucommented, Oct 3, 2017

To the dev branch!

Thanks @marcinlichwala

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to expose all module classes through index.js in Node
Change node_modules/mymodule/lib/mymodule.js to: var exports = module.exports = { version: '0.0.1' } exports.A = require('./a');.
Read more >
How to use module.exports in Node.js - Stack Abuse
We've added all the variables and functions we would like to export to module.exports as properties of the object. We have just accomplished ......
Read more >
New bundled TypeScript typings do not expose various top ...
I stumbled over the same lost exported top-level Logger type when upgrading to the new version. I agree it should be a patch,...
Read more >
Documentation - Modules - TypeScript
If you're only exporting a single class or function , use export default · If you're exporting multiple objects, put them all at...
Read more >
Export and Import - The Modern JavaScript Tutorial
Here are all types of export that we covered in this and previous articles. ... Standalone export: ... Re-export: ... Import: Importing named...
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