| 02:13 | <Jack Works> | write a webpack plugin to support import(spec, { reflect: true }), it returns a VirtualModuleSource (since there is no native ModuleSource available |
| 02:14 | <Jack Works> | but with slightly different semantics, it will call esbuild to bundle all transitive dependencies of ./danger.js, which is different than our proposal proposed. |
| 02:25 | <Jack Works> | I think we need to consider this case in the module reflection proposal: |
| 02:26 | <Jack Works> | when using a library, it might contains many dependencies, but if we're reflecting them one-by-one and use importHook to provide all those files, it will be annoying to adopt, also with worse performance |
| 02:28 | <Jack Works> | e.g. lodash-es has 1000+ esm files, it is unrealistic to import them all as Reflected Module and provide them in importHook, because you need to enumerate all files under that package. |
| 02:29 | <Jack Works> | maybe we can change how import reflection works to make this case more convenient (and easier to be implemented in a bundler) |
| 02:39 | <Jack Works> | proposed change: the import reflection "bundles"/"includes" all transitive dependencies by default, but takes an exclude list for Virtualization. e.g.
When we reflect this module, This is not coinvent if we have many dependencies to virtualize |
| 02:42 | <Jack Works> | Proposed behavior: it will fetch now it will only call |
| 02:47 | <Jack Works> | with a new option to "exclude" some module from the module tree |
| 02:48 | <Jack Works> | e.g. await import('./lib.js', { reflect: true, excludes: ["react"] }). This allows something like "peer dependency" |
| 02:48 | <Jack Works> | The problem of this new proposed way is we need to introduce referrer back again |