Suppose I'm creating an ES6 library with multiple files, but have a root file that contains all of the top-level definitions. How could I achieve something like this example:
lib/foo/sub.js
export class Sub{}
lib/main.js
import { Sub } from './foo/sub'
client.js
# This doesn't work.
import { Sub } from 'lib/main'
I.e., where client only imports from the top-level file (since the sub levels are implementation details -- and later on will likely be encapsulated into a single minified file (but at development time are in multiple files).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…