-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add a default export #18
Conversation
72fdeff
to
3a1fa98
Compare
Above doesn't work, it actually needed to be more like this. Fixed. // @create-index
import _king from './king.js';
export const king = _king;
import _queen from './queen';
export const queen = _queen;
export default {
king,
queen
} |
3a1fa98
to
240c7e8
Compare
This adds a default export object containing all named exports. Eg.: ```js import _king from './king.js'; export const king = _king; import _queen from './queen'; export const queen = _queen; export default { king, queen }; ```
240c7e8
to
474bc92
Compare
What is the reason for wanting this? This breaks static analyses, i.e. it invalidates the purpose of using ES modules in the first place. Default exports should be avoided whenever possible. |
It fixes #11. Copying the relevant part of the problem: For example
creates
where
but
This adds a default export to
Without this |
If I have a project structure such as:
Then I expect to be able: import {king} from './';
import {bar, foo} from './queen'; Anything else, e.g. Invalid in a sense that it invalid use of static analyses and possibility of using shaking. Of course, correct me if I am wrong. My assumptions are based on the knowledge of existing mechanisms used to transpile the code, namely |
You're right it does promote bad design. |
This adds a default export object containing all named exports.
Eg.:
Fixes #11
Keeps
camelCase
support from #16