RFC: add missingExport hook - #1845
Conversation
82c3ca3 to
ef7e51c
Compare
|
rebased |
ef7e51c to
35cd1f6
Compare
35cd1f6 to
de3ba8c
Compare
lukastaegert
left a comment
There was a problem hiding this comment.
I think this does not hurt even though I would expect rollup to fail in most cases if an export is missing. Just have a small naming suggestion, otherwise I think this can go into the next release.
| isPureExternalModule: (id: string) => boolean; | ||
| legacy: boolean; | ||
| load: (id: string) => Promise<SourceDescription | string | void>; | ||
| missingExport: MissingExportHook; |
There was a problem hiding this comment.
I feel this would look less confusing if this name sounded more like a handler, e.g. onMissingExport or handleMissingExport.
There was a problem hiding this comment.
Might want to change the name of the default handler as well. For the hook itself, I think the name is good.
| options?: (options: InputOptions) => void; | ||
| load?: LoadHook; | ||
| resolveId?: ResolveIdHook; | ||
| missingExport?: MissingExportHook; |
There was a problem hiding this comment.
Here I think here the name missingExport is ok as it is more of a label.
|
I have changed the base branch to the new release branch, maybe you want to rebase your commit. |
It would be great to override the behavior of what to do when an export is not found. In most cases, an error is what you want, but in the Ember.js world, leniency would be better.
In Ember.js, ES6 code is transpiled to AMD modules for the browser. This has the side-effect of jamming all exports into a default export. This means that you can write invalid ES6 export/import code that "just works" because of the AMD transpilation.
I would like to gracefully handle this case with a hook. I will then be printing a deprecation warning to Ember users so that invalid Ember code will eventually self-correct,