Skip to content
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

Allow defining external modules dynamically (Bundler) #2122

Open
aldonline opened this issue Aug 21, 2021 · 0 comments
Open

Allow defining external modules dynamically (Bundler) #2122

aldonline opened this issue Aug 21, 2021 · 0 comments

Comments

@aldonline
Copy link

aldonline commented Aug 21, 2021

Problem Statement

Currently, the list of external modules must be fully defined before executing the bundler.

But defining this list statically is not trivial in the following scenarios:

  • imports that "reach into" modules, like import bar from "foo/bar"
  • external modules that are aliased to some other name via an import map or some other form of custom resolution logic

Workaround

The current workaround is to add a custom "pre-bundle" phase where the complete codebase is crawled, each import is visited analyzed (usually by a variation of the logic that will be later used to implement the "Resolve" trait), and a list of external modules is gathered.

This list is then fed to the bundler.

Proposed Solution

Other bundlers like Rollup and ESBuild allow "marking" a module as external during the resolution phase. See: https://rollupjs.org/guide/en/#resolveid

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

No branches or pull requests

1 participant