-
Notifications
You must be signed in to change notification settings - Fork 136
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
Compile to CJS and ESM #1564
Draft
NullVoxPopuli
wants to merge
15
commits into
embroider-build:main
Choose a base branch
from
NullVoxPopuli:cross-target-compilation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Compile to CJS and ESM #1564
NullVoxPopuli
wants to merge
15
commits into
embroider-build:main
from
NullVoxPopuli:cross-target-compilation
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rved script for generating publishable assets
NullVoxPopuli
force-pushed
the
cross-target-compilation
branch
from
September 5, 2023 14:35
f40fe66
to
c5ecd58
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
very wip
at the time of pushing, I've run in to:
which may require untangling the package cycle
Why turbo?
When moving from a one-build-across-the-whole-repo to a build per package, we need to build packages in the "correct order", for example,
@embroider/core
needs to be built before@embroider/addon-dev
. Turbo is really good at this.We only need turbo for script order orchestration, and we don't really care about anything else.
Why build-per-package
the way we've used
tsc
, transpiles each file co-located to the original source location.tsc
does not provide a way to build to multiple targets at once -- additionally,tsc
does not provide a way to change the file extension depending on target -- rollup is really good at this.the way people have used tsc for multi-target projects outside of embroider is to have a
tsc
build per project, where they can specify a separate output directory (dist/cjs
anddist/esm
, for example) -- but this breaks the ability to typecheck the whole repo at once.Build types can happen with tsc still with some "clever CLI args". I want to keep the ts setup mostly the same in this PR, and we can iterate on doing other things with tsc later, but this would allow us to keep monorepo-wide type-checking (
pnpm tsc --watch --noEmit
, for example)Why test packages?
when determinining the package graph, we must ignore cycles. Because devDependencies are no different from dependencies when it comes to "what must be built in what order", we have to untangle the graph. Extracting a test package for relevant packages is one way to untangling cycles in the graph.
What do we lose with this approach?
simplicity
the single
tsc
strategy is very simple, and easy to maintain -- with one build per project we have a lot more files / configs to maintain.@embroider/build
(a new private/internal package)What we keep
the ability to code anywhere, and see errors everywhere