Skip to content

Instantly share code, notes, and snippets.

@ultimatemonty
Created January 31, 2019 15:06
Show Gist options
  • Save ultimatemonty/5e0d676ba02cb67314ce905c8f99272b to your computer and use it in GitHub Desktop.
Save ultimatemonty/5e0d676ba02cb67314ce905c8f99272b to your computer and use it in GitHub Desktop.
wtf imports
// A, B, G are undefined when trying to reference them
import { A, B, G } from 'module-b';
// A, B, G are defined properly
import * as Stuff from 'module-b';
const { A, B, G } = Stuff;
// module-a/index.js
import A from './a';
import B from './b';
import C from './c';
import D from './d';
import E from './e';
import F from './e';
export {
A,
B,
C,
D,
E,
F
};
// module-b/index.js
import * as Things from 'module-a';
import G from './g';
const stuff = {
...Things,
G
};
export default stuff;
@spencerwi
Copy link

Are A, B, C, etc defined as of line 10 in module-a.js? Like, if you toss a console.log there, would it log something or undefined?

Another thing to try:

// in module-a.js, replacing lines 10-17
export {
  A as A,
  B as B,
  C as C,
  D as D,
  E as E,
  F as F
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment